Skip to content

Commit

Permalink
Change order of release automation steps
Browse files Browse the repository at this point in the history
This commit changes the order of release automation steps and collapses
steps into a single job so that the following steps happen sequentially:

1. Wait for artifacts to be released
2. Create GitHub release and tag release commit
3. Create next development version commit and push
4. Announce release on GChat

Other automated steps happen afterwards. This ensures that the full docs
build of Antora sees a tag for the release and a commit on the branch
that do not point to the same version number in gradle.properties.

Closes gh-53
  • Loading branch information
sjohnr committed Oct 29, 2024
1 parent 23ca3f3 commit 11d2c2c
Showing 1 changed file with 37 additions and 53 deletions.
90 changes: 37 additions & 53 deletions .github/workflows/perform-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,29 @@ jobs:
- id: project-version
name: Extract Project Version
run: echo "version=$(cat gradle.properties | grep 'version=' | awk -F'=' '{print $2}')" >> $GITHUB_OUTPUT
- id: next-snapshot-version
name: Calculate Next Snapshot Version
env:
VERSION: ${{ steps.project-version.outputs.version }}
run: echo "version=$(./gradlew -q getNextSnapshotVersion -PcurrentVersion=$VERSION)" >> $GITHUB_OUTPUT
- id: previous-release-milestone
name: Get Previous Release Milestone
env:
VERSION: ${{ steps.project-version.outputs.version }}
run: echo "version=$(./gradlew -q getPreviousReleaseMilestone -PcurrentVersion=$VERSION -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
- id: previous-snapshot-version
name: Get Previous Snapshot Version
env:
VERSION: ${{ steps.next-snapshot-version.outputs.version }}
run: echo "version=$(./gradlew -q getPreviousReleaseMilestone -PcurrentVersion=$VERSION -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
- id: next-release-milestone
name: Get Next Release Milestone
env:
VERSION: ${{ steps.next-snapshot-version.outputs.version }}
run: echo "version=$(./gradlew -q getNextReleaseMilestone -PcurrentVersion=$VERSION -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
- id: has-oss-support
name: Check OSS Support (for current branch)
run: echo "result=$(./gradlew -q checkBranchHasOssSupport -Pbranch=$BRANCH -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
- name: Wait for Milestone Artifacts
if: ${{ contains(steps.project-version.outputs.version, '-RC') || contains(steps.project-version.outputs.version, '-M') }}
env:
Expand Down Expand Up @@ -96,11 +119,22 @@ jobs:
env:
VERSION: ${{ steps.project-version.outputs.version }}
run: ./gradlew createGitHubRelease -PnextVersion=$VERSION -Pbranch=$BRANCH -PcreateRelease=true -PgitHubAccessToken=$TOKEN
- id: previous-release-milestone
name: Get Previous Release Milestone
- name: Update Version
env:
VERSION: ${{ steps.next-snapshot-version.outputs.version }}
run: |
sed -ie "s/^version=.*/version=$VERSION/" gradle.properties
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "Next development version"
git push
- name: Announce Release on GChat
env:
VERSION: ${{ steps.project-version.outputs.version }}
run: echo "version=$(./gradlew -q getPreviousReleaseMilestone -PcurrentVersion=$VERSION -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
ANNOUNCING_ID: ${{ inputs.slack-announcing-id }}
WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}
run: |
curl -X POST '${{ env.WEBHOOK_URL }}' -H 'Content-Type: application/json' -d '{ "text": "${{ env.ANNOUNCING_ID }} `${{ env.VERSION }}` is available now" }' || true
- name: Delete Previous Version
if: ${{ steps.previous-release-milestone.outputs.version != '' }}
env:
Expand All @@ -114,48 +148,6 @@ jobs:
env:
VERSION: ${{ steps.project-version.outputs.version }}
run: ./gradlew closeMilestone -PnextVersion=$VERSION -PgitHubAccessToken=$TOKEN
- name: Announce Release on GChat
env:
VERSION: ${{ steps.project-version.outputs.version }}
ANNOUNCING_ID: ${{ inputs.slack-announcing-id }}
WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}
run: |
curl -X POST '${{ env.WEBHOOK_URL }}' -H 'Content-Type: application/json' -d '{ "text": "${{ env.ANNOUNCING_ID }} `${{ env.VERSION }}` is available now" }' || true
next-development-version:
name: Next Development Version
runs-on: ubuntu-latest
needs: [ perform-release ]
env:
BRANCH: ${{ github.ref_name }}
TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
- name: Set up JDK 17
uses: spring-io/spring-gradle-build-action@v2
- id: project-version
name: Extract Project Version
run: echo "version=$(cat gradle.properties | grep 'version=' | awk -F'=' '{print $2}')" >> $GITHUB_OUTPUT
- id: next-snapshot-version
name: Calculate Next Snapshot Version
env:
VERSION: ${{ steps.project-version.outputs.version }}
run: echo "version=$(./gradlew -q getNextSnapshotVersion -PcurrentVersion=$VERSION)" >> $GITHUB_OUTPUT
- name: Update Version
env:
VERSION: ${{ steps.next-snapshot-version.outputs.version }}
run: |
sed -ie "s/^version=.*/version=$VERSION/" gradle.properties
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "Next development version"
git push
- id: previous-snapshot-version
name: Get Previous Snapshot Version
env:
VERSION: ${{ steps.next-snapshot-version.outputs.version }}
run: echo "version=$(./gradlew -q getPreviousReleaseMilestone -PcurrentVersion=$VERSION -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
- name: Delete Previous Snapshot Version
if: ${{ steps.previous-snapshot-version.outputs.version != '' }}
env:
Expand All @@ -165,14 +157,6 @@ jobs:
env:
VERSION: ${{ steps.next-snapshot-version.outputs.version }}
run: ./gradlew createSaganRelease -PnextVersion=$VERSION -PgitHubAccessToken=$TOKEN
- id: next-release-milestone
name: Get Next Release Milestone
env:
VERSION: ${{ steps.next-snapshot-version.outputs.version }}
run: echo "version=$(./gradlew -q getNextReleaseMilestone -PcurrentVersion=$VERSION -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
- id: has-oss-support
name: Check OSS Support (for current branch)
run: echo "result=$(./gradlew -q checkBranchHasOssSupport -Pbranch=$BRANCH -PgitHubAccessToken=$TOKEN)" >> $GITHUB_OUTPUT
- name: Schedule Next Release (if not already scheduled)
if: ${{ steps.has-oss-support.outputs.result == 'true' }}
env:
Expand Down

0 comments on commit 11d2c2c

Please sign in to comment.