1+ name : Publish async-query-core to maven
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+ - 1.*
9+ - 2.*
10+ paths :
11+ - ' async-query-core/**'
12+ - ' .github/workflows/publish-async-query-core.yml'
13+ - ' .github/maven-publish-utils.sh'
14+ - ' .github/get-sonatype-credentials.sh'
15+
16+ concurrency :
17+ group : maven-publish-async-query-core
18+ cancel-in-progress : false
19+
20+ env :
21+ SNAPSHOT_REPO_URL : https://aws.oss.sonatype.org/content/repositories/snapshots/
22+ COMMIT_MAP_FILENAME : commit-history-async-query-core.json
23+
24+ jobs :
25+ publish-async-query-core :
26+ strategy :
27+ fail-fast : false
28+ if : github.repository == 'opensearch-project/sql'
29+ runs-on : ubuntu-latest
30+
31+ permissions :
32+ id-token : write
33+ contents : write
34+
35+ steps :
36+ - uses : actions/setup-java@v3
37+ with :
38+ distribution : temurin
39+ java-version : 21
40+
41+ - uses : actions/checkout@v3
42+
43+ - uses : aws-actions/configure-aws-credentials@v1.7.0
44+ with :
45+ role-to-assume : ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
46+ aws-region : us-east-1
47+
48+ - name : Setup publishing credentials
49+ id : creds
50+ run : |
51+ .github/get-sonatype-credentials.sh
52+
53+ - name : Set commit ID
54+ id : set_commit
55+ run : |
56+ COMMIT_ID=$(git log -1 --format='%H')
57+ echo "commit_id=${COMMIT_ID}" >> $GITHUB_OUTPUT
58+ echo "Using commit ID: ${COMMIT_ID}"
59+
60+ - name : Extract version from build.gradle
61+ id : extract_version
62+ run : |
63+ VERSION=$(grep -m 1 "archiveVersion.set" ./async-query-core/build.gradle | sed -n "s/.*archiveVersion.set('\([^']*\)').*/\1/p")
64+
65+ if [[ ! $VERSION == *-SNAPSHOT ]]; then
66+ VERSION="${VERSION}-SNAPSHOT"
67+ fi
68+
69+ echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
70+ echo "Version: ${VERSION}"
71+
72+ - uses : actions/checkout@v4
73+ with :
74+ repository : ' opensearch-project/opensearch-build-libraries'
75+ path : ' build'
76+
77+ - name : Install required tools
78+ run : sudo apt-get update && sudo apt-get install -y xmlstarlet jq
79+
80+ - name : Publish async-query-core
81+ run : |
82+ # Source the utility functions
83+ source ./.github/maven-publish-utils.sh
84+
85+ # Call the main function for async-query-core
86+ publish_async_query_core "${{ steps.extract_version.outputs.VERSION }}" "${{ steps.set_commit.outputs.commit_id }}"
0 commit comments