Skip to content

Release

Release #239

Workflow file for this run

name: Release
on:
release:
types: [published]
jobs:
build:
name: Release artifacts to Bintray, Maven Central & SDKMAN, and publish documentation
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.release_version.outputs.value }}
env:
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 }}
GIT_USER_NAME: puneetbehl
GIT_USER_EMAIL: [email protected]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- name: Set the current release version
id: release_version
run: |
echo "Update grailsVersion to ${{steps.release_version.outputs.value}}"
sed -i "s/^grailsVersion.*$/grailsVersion\=${GITHUB_REF:11}/" gradle.properties
echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
- uses: stefanzweifel/[email protected]
with:
commit_message: Update grailsVersion to ${{ steps.release_version.outputs.value }}
commit_user_name: ${{ env.GIT_USER_NAME }}
commit_user_email: ${{ env.GIT_USER_EMAIL }}
commit_author: ${{ env.GIT_USER_NAME }} <${{ env.GIT_USER_EMAIL }}>
file_pattern: gradle.properties
- name: Run pre-release
uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build All
run: ./gradlew grails-cli:assemble
- name: Generate secring file
env:
SECRING_FILE: ${{ secrets.SECRING_FILE }}
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
- name: Publish to Maven Central
if: false # Disabled until we have a new release
uses: gradle/gradle-build-action@v2
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
with:
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository docs
- name: Upload CLI Zip
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: grails-cli/build/distributions/grails-cli-${{ steps.release_version.outputs.value }}.zip
asset_name: grails-cli-${{ steps.release_version.outputs.value }}.zip
asset_content_type: application/zip
- name: Publish to Github Pages
if: success() && false # Disabled until we have a new release
uses: micronaut-projects/github-pages-deploy-action@master
env:
BETA: ${{ contains(steps.release_version.outputs.value, 'M') }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BASE_BRANCH: 6.1.x
BRANCH: gh-pages
FOLDER: build/docs
VERSION: ${{ steps.release_version.outputs.value }}
- name: Run post-release
if: success()
id: post_release
continue-on-error: true
uses: micronaut-projects/github-actions/post-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Back to snapshot
continue-on-error: true
run: |
echo "Setting new Grails snapshot version"
sed -i "s/^grailsVersion.*$/grailsVersion\=${{ steps.post_release.outputs.next_version }}-SNAPSHOT/" gradle.properties
- uses: stefanzweifel/[email protected]
continue-on-error: true
with:
commit_message: Back Grails version to snapshot
commit_user_name: ${{ env.GIT_USER_NAME }}
commit_user_email: ${{ env.GIT_USER_EMAIL }}
commit_author: ${{ env.GIT_USER_NAME }} <${{ env.GIT_USER_EMAIL }}>
file_pattern: gradle.properties
deploy:
name: Deploy To Google Cloud Run
runs-on: ubuntu-latest
needs: [build]
env:
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 }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: v${{ needs.build.outputs.release_version }}
token: ${{ secrets.GH_TOKEN }}
- name: Login
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_EMAIL }}
service_account_key: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: '11'
- name: Run Tests
uses: gradle/gradle-build-action@v2
env:
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 }}
with:
arguments: grails-forge-api:test grails-forge-web-netty:test
- name: Build Docker image
# To deploy native executables built with GraalVM replace dockerBuild with dockerBuildNative and dockerPush with dockerPushNative. First, try that it works locally.
uses: gradle/gradle-build-action@v2
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }}
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 }}
with:
arguments: grails-forge-web-netty:dockerBuildNative -PdockerImageName=${{ env.IMAGE_NAME }}
- name: Push image to Google Cloud Container Registry
uses: gradle/gradle-build-action@v2
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }}
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 }}
with:
arguments: grails-forge-web-netty:dockerPushNative -PdockerImageName=${{ env.IMAGE_NAME }}
- name: Deploy Docker image
env:
release_version: ${{ needs.build.outputs.release_version }}
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }}
run: |
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-latest --image $IMAGE_NAME --region us-central1 --update-env-vars=HOSTNAME="latest.grails.org",CORS_ALLOWED_ORIGIN="https://start.grails.org",GITHUB_OAUTH_APP_CLIENT_ID=${{ secrets.GH_OAUTH_LATEST_CLIENT_ID }},GITHUB_OAUTH_APP_CLIENT_SECRET=${{ secrets.GH_OAUTH_LATEST_CLIENT_SECRET }},GITHUB_USER_AGENT=${{ secrets.GH_USER_AGENT }},GITHUB_REDIRECT_URL=${{ secrets.GH_REDIRECT_URL }} --platform managed --allow-unauthenticated --service-account=${{ secrets.GCLOUD_EMAIL }}
version="$(echo "${release_version//./}" | tr '[A-Z]' '[a-z]')"
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-$version --image $IMAGE_NAME --region us-central1 --update-env-vars=HOSTNAME="grailsforge-600-cjmq3uyfcq-uc.a.run.app",CORS_ALLOWED_ORIGIN="https://start.grails.org",GITHUB_OAUTH_APP_CLIENT_ID=${{ secrets.GH_OAUTH_LATEST_CLIENT_ID }},GITHUB_OAUTH_APP_CLIENT_SECRET=${{ secrets.GH_OAUTH_LATEST_CLIENT_SECRET }},GITHUB_USER_AGENT=${{ secrets.GH_USER_AGENT }},GITHUB_REDIRECT_URL=${{ secrets.GH_REDIRECT_URL }} --platform managed --allow-unauthenticated --service-account=${{ secrets.GCLOUD_EMAIL }}
deployanalytics:
name: Deploy Analytics To Google Cloud Run
runs-on: ubuntu-latest
needs: [build]
env:
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 }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: v${{ needs.build.outputs.release_version }}
token: ${{ secrets.GH_TOKEN }}
- name: Login
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_EMAIL }}
service_account_key: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: '11'
- name: Run Tests
uses: gradle/gradle-build-action@v2
env:
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 }}
with:
arguments: grails-forge-analytics-postgres:test
- name: Build Docker image
uses: gradle/gradle-build-action@v2
# To deploy native executables built with GraalVM replace dockerBuild with dockerBuildNative and dockerPush with dockerPushNative. First, try that it works locally.
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ needs.build.outputs.release_version }}
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 }}
with:
arguments: grails-forge-analytics-postgres:dockerBuildNative -PdockerImageName=${{ env.IMAGE_NAME }}
- name: Push image to Google Cloud Container Registry
uses: gradle/gradle-build-action@v2
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ needs.build.outputs.release_version }}
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 }}
with:
arguments: grails-forge-analytics-postgres:dockerPushNative -PdockerImageName=${{ env.IMAGE_NAME }}
- name: Deploy Docker image
env:
release_version: ${{ needs.build.outputs.release_version }}
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }}
run: |
gcloud components install beta --quiet
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-analytics-latest --image $IMAGE_NAME --region us-central1 --platform managed --allow-unauthenticated --service-account=${{ secrets.GCLOUD_EMAIL }}
version="$(echo "${release_version//./}" | tr '[A-Z]' '[a-z]')"
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-analytics-$version --image $IMAGE_NAME --region us-central1 --platform managed --allow-unauthenticated --service-account=${{ secrets.GCLOUD_EMAIL }}
linux:
name: Release Linux Native CLI
runs-on: ubuntu-latest
env:
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 }}
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: v${{ needs.build.outputs.release_version }}
token: ${{ secrets.GH_TOKEN }}
- name: Setup GraalVM CE
uses: graalvm/[email protected]
with:
version: '21.3.3.1'
java-version: '11'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build the JAR
uses: gradle/gradle-build-action@v2
with:
arguments: grails-cli:shadowJar --no-daemon
- name: Build Native Image
run: native-image --no-fallback --allow-incomplete-classpath -cp grails-cli/build/libs/grails-cli-*-all.jar
- name: Verify Build
run: ./grails --version
- name: Package Build
env:
VERSION: ${{ github.event.release.tag_name }}
run: |
mkdir -p "grails-linux-amd64-${VERSION}/bin"
mv ./grails "grails-linux-amd64-${VERSION}/bin"
cp ./LICENSE "grails-linux-amd64-${VERSION}/"
zip -r "grails-linux-amd64-${VERSION}.zip" "grails-linux-amd64-${VERSION}/"
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./grails-linux-amd64-${{ github.event.release.tag_name }}.zip
asset_name: grails-linux-amd64-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip
macos:
name: Release OS X Native CLI
runs-on: macos-latest
env:
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 }}
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: v${{ needs.build.outputs.release_version }}
token: ${{ secrets.GH_TOKEN }}
- name: Setup GraalVM CE
uses: graalvm/[email protected]
with:
version: '21.3.3.1'
java-version: '11'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build the JAR
uses: gradle/gradle-build-action@v2
with:
arguments: grails-cli:shadowJar --no-daemon
- name: Build Native Image
run: native-image --no-fallback --allow-incomplete-classpath -cp grails-cli/build/libs/grails-cli-*-all.jar
- name: Verify Build
run: ./grails --version
- name: Package Build
env:
VERSION: ${{ github.event.release.tag_name }}
run: |
mkdir -p "grails-darwin-amd64-${VERSION}/bin"
mv ./grails "grails-darwin-amd64-${VERSION}/bin"
cp ./LICENSE "grails-darwin-amd64-${VERSION}/"
zip -r "grails-darwin-amd64-${VERSION}.zip" "grails-darwin-amd64-${VERSION}/" -x '*.DS_Store*' -x '__MAC_OSX'
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./grails-darwin-amd64-${{ github.event.release.tag_name }}.zip
asset_name: grails-darwin-amd64-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip
windows:
name: Release Windows Native CLI
runs-on: windows-latest
env:
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 }}
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: v${{ needs.build.outputs.release_version }}
token: ${{ secrets.GH_TOKEN }}
- name: Setup GraalVM CE
uses: graalvm/[email protected]
with:
version: '21.3.3.1'
java-version: '11'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build JAR File
uses: gradle/gradle-build-action@v2
with:
arguments: grails-cli:copyShadowJar --no-daemon
- name: Build Native Image
shell: powershell
run: native-image.cmd --no-fallback --allow-incomplete-classpath -cp build/libs/cli.jar
- name: Verify Build (Powershell)
run: ./grails.exe --version
- name: Verify Create App (Powershell)
run: ./grails.exe create-app test
- name: Verify Build (CMD)
shell: cmd
run: grails --version
- name: Verify Create App (CMD)
shell: cmd
run: grails create-app test2
- name: ZIP Archive
run: |
New-Item ./grails-win-amd64-${{ github.event.release.tag_name }}/bin -ItemType Directory -ea 0
Move-Item -Path ./grails.exe -Destination ./grails-win-amd64-${{ github.event.release.tag_name }}/bin
Copy-Item ./LICENSE -Destination ./grails-win-amd64-${{ github.event.release.tag_name }}
Compress-Archive -Path ./grails-win-amd64-${{ github.event.release.tag_name }} -Update -DestinationPath ./grails-win-amd64-${{ github.event.release.tag_name }}.zip
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./grails-win-amd64-${{ github.event.release.tag_name }}.zip
asset_name: grails-win-amd64-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip
sdkman:
name: Release to SDKMAN!
if : false # Disabled until we have a new release
runs-on: ubuntu-latest
env:
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 }}
needs: [linux, macos, windows]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: v${{ needs.build.outputs.release_version }}
token: ${{ secrets.GH_TOKEN }}
- name: Grails SDK Minor Release
if: contains(needs.build.outputs.release_version, 'M')
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: startsWith(needs.build.outputs.release_version, '6.') && !contains(needs.build.outputs.release_version, 'M')
uses: gradle/gradle-build-action@v2
with:
arguments: sdkMajorRelease
env:
GVM_SDKVENDOR_KEY: ${{ secrets.GVM_SDKVENDOR_KEY }}
GVM_SDKVENDOR_TOKEN: ${{ secrets.GVM_SDKVENDOR_TOKEN }}