Repository navigation
chore: new release processes #1090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joaodordio
wants to merge
6
commits into
master
Choose a base branch
from
chore/new-release-processes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a789c69
chore: add Prepare Release and Publish Release workflows
joaodordio 090f899
fix: pin checkout to default branch, use notes-file, anchor CHANGELOG…
joaodordio 56317c5
chore: use iterable-sdk-release GitHub App for all release auth
joaodordio cf931f9
fix: address PR review feedback on release workflows
jferrao-itrbl 21615fd
fix: harden publish retry, tag alignment, and prepare version bumps
jferrao-itrbl e17b8ad
fix: use lightweight force tag in publish release workflow
jferrao-itrbl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| name: Publish Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version to publish (e.g., 3.6.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| env: | ||
| VERSION: ${{ github.event.inputs.version }} | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| publish-release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/create-github-app-token@v1 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ vars.ITERABLE_SDK_RELEASE_APP_ID }} | ||
| private-key: ${{ secrets.ITERABLE_SDK_RELEASE_APP_PRIVATE_KEY }} | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: master | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - name: Verify release is ready | ||
| id: verify_changelog | ||
| run: | | ||
| if ! grep -qE "^## \[$VERSION\]" CHANGELOG.md; then | ||
| echo "::error::CHANGELOG.md has no entry for [$VERSION]. Merge the prepare-release PR to master before running this workflow." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Ensure GitHub release exists | ||
| id: release_state | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| if ! gh release view "$VERSION" &>/dev/null; then | ||
| echo "::error::No GitHub release found for $VERSION. Run Prepare Release before publishing." | ||
| exit 1 | ||
| fi | ||
| is_draft=$(gh release view "$VERSION" --json isDraft -q .isDraft) | ||
| echo "is_draft=$is_draft" >> "$GITHUB_OUTPUT" | ||
| if [ "$is_draft" = "true" ]; then | ||
| echo "Release $VERSION is a draft; will publish on GitHub before Maven Central." | ||
| else | ||
| echo "Release $VERSION is already published; retrying tag alignment and Maven Central upload." | ||
| fi | ||
|
|
||
| - name: Publish draft GitHub release | ||
| if: steps.release_state.outputs.is_draft == 'true' | ||
| id: publish_github | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| target="$(git rev-parse HEAD)" | ||
| if [[ "$VERSION" == *-* ]]; then | ||
| gh release edit "$VERSION" \ | ||
| --draft=false \ | ||
| --target "$target" \ | ||
| --prerelease | ||
| else | ||
| gh release edit "$VERSION" \ | ||
| --draft=false \ | ||
| --target "$target" \ | ||
| --latest | ||
| fi | ||
|
|
||
| - name: Point release tag at master HEAD | ||
| id: align_tag | ||
| run: | | ||
| target="$(git rev-parse HEAD)" | ||
| # gh release edit does not move an existing tag; align tag to the merged release commit. | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git tag -f "$VERSION" "$target" | ||
| git push origin "refs/tags/$VERSION" --force | ||
|
|
||
| - name: Set up JDK | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: "17" | ||
| distribution: "temurin" | ||
| cache: gradle | ||
|
|
||
| - name: Import GPG Key | ||
| run: | | ||
| echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --import | ||
| gpg --batch --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --export-secret-keys > ~/.gnupg/secring.gpg | ||
| GPG_KEY_ID="${{ secrets.GPG_KEY_ID }}" | ||
| echo "SHORT_GPG_KEY_ID=${GPG_KEY_ID: -8}" >> $GITHUB_ENV | ||
|
|
||
| - name: Publish to Sonatype Central | ||
| id: central | ||
| run: ./gradlew clean :iterableapi:assemble :iterableapi-ui:assemble publishAllPublicationsToCentralPortal | ||
| env: | ||
| ORG_GRADLE_PROJECT_SIGNING_KEY_ID: ${{ env.SHORT_GPG_KEY_ID }} | ||
| ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }} | ||
| ORG_GRADLE_PROJECT_SIGNING_SECRET_KEY_RING_FILE: /home/runner/.gnupg/secring.gpg | ||
| ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
| ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
|
|
||
| - name: Slack notification | ||
| if: steps.central.outcome == 'success' | ||
| continue-on-error: true | ||
| run: | | ||
| release_url="https://github.com/${{ github.repository }}/releases/tag/$VERSION" | ||
| payload=$(jq -n \ | ||
| --arg text ":android: *Android SDK ${VERSION}* has been released. <${release_url}|View release notes>." \ | ||
| '{"text": $text}') | ||
| curl -sS -f -X POST -H 'Content-type: application/json' --data "$payload" "${{ secrets.SLACK_WEBHOOK }}" | ||
|
|
||
| - name: Slack failure notification | ||
| if: failure() && steps.central.outcome != 'success' | ||
| run: | | ||
| run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}" | ||
| payload=$(jq -n \ | ||
| --arg text ":alert: Android SDK release ${VERSION} failed (attempt ${{ github.run_attempt }}). Run: ${run_url}" \ | ||
| '{"text": $text}') | ||
| curl -sS -f -X POST -H 'Content-type: application/json' --data "$payload" "${{ secrets.SLACK_WEBHOOK }}" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.