Pre Release #3
This file contains 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
name: "π¨οΈ Pre Release" | |
on: | |
workflow_dispatch: | |
inputs: | |
targetVersion: | |
description: 'Expected Release Version' | |
required: true | |
env: | |
GIT_USER_NAME: 'grails-build' | |
GIT_USER_EMAIL: '[email protected]' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
# - name: "π₯ Purge Existing Builds - org.grails.grails-gsp" | |
# run: | | |
# curl -L \ | |
# -X DELETE \ | |
# -H "Accept: application/vnd.github+json" \ | |
# -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
# -H "X-GitHub-Api-Version: 2022-11-28" \ | |
# https://api.github.com/orgs/${{ github.repository_owner }}/packages/maven/org.grails.grails-gsp || true | |
- name: "π₯ Checkout repository" | |
uses: actions/checkout@v4 | |
- name: "π Set Prevent Snapshot Publishing Flag" | |
run: | | |
sed -i "s/^preventSnapshotPublish.*$/preventSnapshotPublish\=true/" gradle.properties | |
- name: "π© Commit flag to prevent snapshot publishing" | |
run: | | |
git config user.name "${{ env.GIT_USER_NAME }}" | |
git config user.email "${{ env.GIT_USER_EMAIL }}" | |
git add gradle.properties | |
if ! git diff --cached --quiet; then | |
git commit -m "[skip ci] Pre Release - ${{ github.event.inputs.targetVersion }} - Preventing Snapshot Publishing" | |
git push origin HEAD | |
else | |
echo "Publishing already disabled." | |
fi | |
- name: "βοΈ Setup JDK" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'liberica' | |
java-version: '17' | |
- name: "π Setup Gradle" | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | |
- name: "β Set version to ${{ github.event.inputs.targetVersion }}" | |
run: | | |
sed -i "s/^projectVersion.*$/projectVersion\=${{ github.event.inputs.targetVersion }}/" gradle.properties | |
cat gradle.properties | |
- name: "𧩠Run Assemble" | |
if: success() | |
run: ./gradlew assemble | |
env: | |
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} | |
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} | |
- name: "π Generate key file for artifact signing" | |
env: | |
SECRING_FILE: ${{ secrets.SECRING_FILE }} | |
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg | |
- name: "π€ Publish to GitHub Packages" | |
id: publish | |
env: | |
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} | |
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} | |
GITHUB_USERNAME: ${{ secrets.GITHUB_ACTOR }} | |
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_PUBLISH: 'true' | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} | |
SECRING_FILE: ${{ secrets.SECRING_FILE }} | |
run: > | |
./gradlew | |
-Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg | |
publish |