Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: Publish Release

on:
push:
branches:
- main
- '*-main' # Matches 5.4-main, 5.5-main, etc.
workflow_dispatch:
inputs:
ref:
description: "Branch or commit SHA to run on"
required: false
default: "main"
release_on_maven:
description: "Release on Maven Central"
required: true
default: true
type: boolean

permissions:
contents: write
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
runs-on: ubuntu-latest

# Auto-run only if this is a rel/* merge commit, OR manual dispatch
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disabled the auto run for now.

if: github.event_name == 'workflow_dispatch' ||
(startsWith(github.event.head_commit.message, 'Merge pull request') &&
contains(github.event.head_commit.message, 'rel/'))

env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
Expand Down Expand Up @@ -94,7 +94,16 @@ jobs:
-Psigning.password="$SDK_SIGNING_PASSWORD" \
-Psigning.secretKeyRingFile="$GPG_FILE_PATH"

- name: Publish to Maven Central
- name: Determine Publishing Method
run: |
if [[ "${{ github.event.inputs.release_on_maven }}" == "true" ]]; then
echo "✅ Publishing to Maven Central And Release"
else
echo "🏠 Publishing to Maven Central - Not Releasing"
fi

- name: Publish and Release to Maven Central
if: github.event.inputs.release_on_maven == 'true'
working-directory: OneSignalSDK
run: |
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache \
Expand All @@ -104,11 +113,20 @@ jobs:
-Psigning.password="$SDK_SIGNING_PASSWORD" \
-Psigning.secretKeyRingFile="$GPG_FILE_PATH"

- name: Get latest merged rel/* PR
- name: Publish Only to Maven Central
if: github.event.inputs.release_on_maven != 'true'
working-directory: OneSignalSDK
run: |
./gradlew publishToMavenCentral --no-configuration-cache \
-PmavenCentralUsername="$MAVEN_USERNAME" \
-PmavenCentralPassword="$MAVEN_PASSWORD" \
-Psigning.keyId="$SDK_SIGNING_KEY_ID" \
-Psigning.password="$SDK_SIGNING_PASSWORD" \
-Psigning.secretKeyRingFile="$GPG_FILE_PATH"

- name: Get latest merged rel/* PR into main
id: fetch_pr
run: |
echo "Looking for merged release PRs into base branch: $CURRENT_BRANCH"

PR_JSON=$(gh pr list \
--state merged \
--base "$CURRENT_BRANCH" \
Expand All @@ -127,6 +145,7 @@ jobs:
echo "$PR_BODY" > release_notes.md

- name: Tag and create GitHub Release
if: github.event.inputs.release_on_maven == 'true'
run: |
VERSION="${{ env.SDK_VERSION }}"

Expand Down Expand Up @@ -154,4 +173,4 @@ jobs:
gh release create "$VERSION" \
--title "$VERSION" \
--notes-file release_notes.md \
$PRERELEASE
$PRERELEASE
Loading