Skip to content

Commit

Permalink
Improvements to Release Workflow (#13301)
Browse files Browse the repository at this point in the history
Breakdown Release Workflow into multiple jobs
  • Loading branch information
puneetbehl authored Dec 19, 2023
1 parent 6764e33 commit f35ed0b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 41 deletions.
5 changes: 2 additions & 3 deletions .github/actions/pre-release/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ cat gradle.properties
echo "Pushing release version and recreating v${release_version} tag"
git add gradle.properties
git add grails-core/src/test/groovy/grails/util/GrailsUtilTests.java
git commit -m "Release v${release_version}"
git push origin :refs/tags/v${release_version}
git commit -m "[skip ci] Release v${release_version}"
git tag -fa v${release_version} -m "Release v${release_version}"
git push origin v${release_version}
git push origin v${release_version} --force

echo "Closing again the release after updating the tag"
release_url=`cat $GITHUB_EVENT_PATH | jq '.release.url' | sed -e 's/^"\(.*\)"$/\1/g'`
Expand Down
109 changes: 71 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ on:
types: [published]
permissions: {}
jobs:
release:
publish:
permissions:
contents: write # to create release
issues: write # to modify milestones
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.release_version.outputs.value }}
target_branch: ${{ steps.extract_branch.outputs.value }}
env:
GIT_USER_NAME: puneetbehl
GIT_USER_EMAIL: behlp@objectcomputing.com
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
GIT_USER_EMAIL: behlp@unityfoundation.io
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -32,12 +34,13 @@ jobs:
echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT
- name: Set the current release version
id: release_version
run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
- name: Run pre-release
uses: ./.github/actions/pre-release
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Assemble
if: success()
id: assemble
uses: gradle/gradle-build-action@v2
with:
Expand All @@ -46,13 +49,28 @@ jobs:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
- name: Upload Distribution
if: success()
uses: actions/upload-artifact@v3
with:
name: grails-${{ steps.release_version.outputs.value }}.zip
path: build/distributions/grails-${{ steps.release_version.outputs.value }}.zip
- name: Upload artifacts to the Github release
if: success()
id: upload_artifact
uses: Roang-zero1/github-upload-release-artifacts-action@master
with:
args: build/distributions/grails-${{ steps.release_version.outputs.value }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate secring file
if: success()
env:
SECRING_FILE: ${{ secrets.SECRING_FILE }}
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
- name: Publish to Sonatype OSSRH
id: publish
if: steps.assemble.outcome == 'success'
if: success()
uses: gradle/gradle-build-action@v2
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
Expand All @@ -68,60 +86,75 @@ jobs:
with:
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Run post-release
if: steps.publish.outcome == 'success'
if: success()
uses: ./.github/actions/post-release
with:
token: ${{ secrets.GITHUB_TOKEN }}
env:
SNAPSHOT_SUFFIX: -SNAPSHOT
- name: Upload artifacts to the Github release
id: upload_artifact
if: steps.publish.outcome == 'success'
uses: Roang-zero1/github-upload-release-artifacts-action@master
sdkman:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
ref: v${{ needs.publish.outputs.release_version }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
- name: Grails SDK Minor Release
if: success()
uses: gradle/gradle-build-action@v2
with:
args: build/distributions/grails-${{ steps.release_version.outputs.release_version }}.zip
arguments: sdkMinorRelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Message for the Grails Documentation Release
if: steps.publish.outcome == 'success'
id: grails_docs_release_message
GVM_SDKVENDOR_KEY: ${{ secrets.GVM_SDKVENDOR_KEY }}
GVM_SDKVENDOR_TOKEN: ${{ secrets.GVM_SDKVENDOR_TOKEN }}
docs:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Prepare Input
id: prep_inputs
run: |
echo "value={\"grails_version\":\"$RELEASE_VERSION\"}" >> $GITHUB_OUTPUT
env:
RELEASE_VERSION: ${{ steps.release_version.outputs.release_version }}
RELEASE_VERSION: ${{ needs.publish.outputs.release_version }}
- name: Invoke grails-doc release workflow
if: steps.publish.outcome == 'success'
id: grails_doc
uses: benc-uk/workflow-dispatch@v1.2
with:
workflow: Release
repo: grails/grails-doc
ref: ${{ steps.extract_branch.outputs.value }}
ref: ${{ needs.publish.outputs.target_branch }}
token: ${{ secrets.GH_TOKEN }}
inputs: ${{ steps.grails_docs_release_message.outputs.value }}
inputs: ${{ steps.prep_inputs.outputs.value }}
website:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Prepare Input
id: prep_inputs
run: |
echo "value={\"grails_version\":\"$RELEASE_VERSION\"}" >> $GITHUB_OUTPUT
env:
RELEASE_VERSION: ${{ needs.publish.outputs.release_version }}
- name: Invoke grails-static-website release workflow
if: steps.publish.outcome == 'success'
if: success()
id: grails_static_website
uses: benc-uk/workflow-dispatch@v1.2
with:
workflow: Release
repo: grails/grails-static-website
ref: master
token: ${{ secrets.GH_TOKEN }}
inputs: ${{ steps.grails_docs_release_message.outputs.value }}
- name: Grails SDK Minor Release
if: steps.upload_artifact.outcome == 'success' && (startsWith(steps.release_version.outputs.release_version, '3.3') || startsWith(steps.release_version.outputs.release_version, '4.1.') || startsWith(steps.release_version.outputs.release_version, '5.3.'))
uses: gradle/gradle-build-action@v2
with:
arguments: sdkMinorRelease
env:
GVM_SDKVENDOR_KEY: ${{ secrets.GVM_SDKVENDOR_KEY }}
GVM_SDKVENDOR_TOKEN: ${{ secrets.GVM_SDKVENDOR_TOKEN }}
- name: Grails SDK Major Release
if: steps.upload_artifact.outcome == 'success' && !(startsWith(steps.release_version.outputs.release_version, '3.3') || startsWith(steps.release_version.outputs.release_version, '4.1.') || startsWith(steps.release_version.outputs.release_version, '5.3.') || contains(steps.release_version.outputs.release_version, 'M') || contains(steps.release_version.outputs.release_version, 'RC'))
uses: gradle/gradle-build-action@v2
with:
arguments: sdkMajorRelease
env:
GVM_SDKVENDOR_KEY: ${{ secrets.GVM_SDKVENDOR_KEY }}
GVM_SDKVENDOR_TOKEN: ${{ secrets.GVM_SDKVENDOR_TOKEN }}
inputs: ${{ steps.prep_inputs.outputs.value }}

0 comments on commit f35ed0b

Please sign in to comment.