forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (70 loc) · 2.56 KB
/
publish-async-query-core.yml
File metadata and controls
86 lines (70 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Publish async-query-core to maven
on:
workflow_dispatch:
push:
branches:
- main
- 1.*
- 2.*
paths:
- 'async-query-core/**'
- '.github/workflows/publish-async-query-core.yml'
- '.github/maven-publish-utils.sh'
- '.github/get-sonatype-credentials.sh'
concurrency:
group: maven-publish-async-query-core
cancel-in-progress: false
env:
SNAPSHOT_REPO_URL: https://central.sonatype.com/repository/maven-snapshots/
COMMIT_MAP_FILENAME: commit-history-async-query-core.json
jobs:
publish-async-query-core:
strategy:
fail-fast: false
if: github.repository == 'opensearch-project/sql'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
- uses: actions/checkout@v3
- name: Load secret
uses: 1password/load-secrets-action@v2
with:
# Export loaded secrets as environment variables
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
- name: Set commit ID
id: set_commit
run: |
COMMIT_ID=$(git log -1 --format='%H')
echo "commit_id=${COMMIT_ID}" >> $GITHUB_OUTPUT
echo "Using commit ID: ${COMMIT_ID}"
- name: Extract version from build.gradle
id: extract_version
run: |
VERSION=$(grep -m 1 "archiveVersion.set" ./async-query-core/build.gradle | sed -n "s/.*archiveVersion.set('\([^']*\)').*/\1/p")
if [[ ! $VERSION == *-SNAPSHOT ]]; then
VERSION="${VERSION}-SNAPSHOT"
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- uses: actions/checkout@v4
with:
repository: 'opensearch-project/opensearch-build'
path: 'build'
- name: Install required tools
run: sudo apt-get update && sudo apt-get install -y xmlstarlet jq
- name: Publish async-query-core
run: |
# Source the utility functions
source ./.github/maven-publish-utils.sh
# Call the main function for async-query-core
publish_async_query_core "${{ steps.extract_version.outputs.VERSION }}" "${{ steps.set_commit.outputs.commit_id }}"