11name : Publish Release
22
33on :
4- pull_request :
5- types :
6- - closed
4+ push :
75 branches :
86 - main
97
@@ -13,7 +11,7 @@ permissions:
1311
1412jobs :
1513 publish :
16- if : github.event.pull_request.merged == true && startsWith (github.event.pull_request.head.ref , 'rel/')
14+ if : contains (github.event.head_commit.message , 'rel/')
1715 runs-on : ubuntu-latest
1816
1917 env :
2523 GPG_FILE_NAME : onesignal_sdk_gpg_subkeys
2624
2725 steps :
28- - name : Checkout release branch
29- uses : actions/checkout@v3
30- with :
31- ref : ${{ github.event.pull_request.head.ref }}
26+ - name : Checkout main
27+ uses : actions/checkout@v5
3228
3329 - name : Ensure Java 11 or 17
3430 run : |
5854 run : ./gradlew assembleRelease
5955 working-directory : OneSignalSDK
6056
57+ - name :
58+ Dry Run : Publish to Maven Local with signing
59+ run : |
60+ ./gradlew publishToMavenLocal --no-configuration-cache \
61+ -Psigning.keyId="$SDK_SIGNING_KEY_ID" \
62+ -Psigning.password="$SDK_SIGNING_PASSWORD" \
63+ -Psigning.secretKeyRingFile="$(pwd)/$GPG_FILE_NAME"
64+ working-directory : OneSignalSDK
65+
6166 - name : Publish to Maven Central
6267 run : |
6368 ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache \
@@ -68,14 +73,10 @@ jobs:
6873 -Psigning.secretKeyRingFile="$(pwd)/$GPG_FILE_NAME"
6974 working-directory : OneSignalSDK
7075
71- - name : Authenticate gh CLI
72- run : echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
73-
7476 - name : Tag and create GitHub Release
7577 run : |
7678 VERSION="${{ env.SDK_VERSION }}"
7779
78- # Determine release channel
7980 if [[ "$VERSION" == *"alpha"* ]]; then
8081 PRERELEASE="--prerelease"
8182 CHANNEL="alpha"
@@ -87,15 +88,17 @@ jobs:
8788 CHANNEL="current"
8889 fi
8990
90- # Extract PR body as release notes
91- PR_NUMBER=$(echo "${{ github.event.pull_request.number }}")
92- PR_BODY=$(gh pr view "$PR_NUMBER" --json body -q ".body")
91+ # Fetch PR body using the commit SHA
92+ PR_BODY=$(gh api /repos/${{ github.repository }}/commits/${{ github.sha }}/pulls \
93+ -H "Accept: application/vnd.github.groot-preview+json" \
94+ --jq '.[0].body')
95+
9396 echo -e "Channels: $CHANNEL\n\n$PR_BODY" > release_notes.md
9497
9598 git config user.name "github-actions[bot]"
9699 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
97100
98- echo "Tagging release v $VERSION"
101+ echo "Tagging release $VERSION"
99102 git tag "$VERSION"
100103 git push origin "$VERSION"
101104
@@ -105,5 +108,4 @@ jobs:
105108 --notes-file release_notes.md \
106109 $PRERELEASE
107110 env :
108- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
109-
111+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments