From 692cff0a87cb12f2f17e4486b0716f2468926de2 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Tue, 10 Dec 2024 13:12:34 -0500 Subject: [PATCH 01/10] Split main Java CI build into gradle.yml workflow from Snapshot GPC deploy in snapshot.yml adjust Java versions, the snapshot workflow is now run manually so the desired branch or tag can be deployed --- .github/workflows/gradle.yml | 220 +++++++++++++++++++++++++++++++++ .github/workflows/snapshot.yml | 211 +------------------------------ 2 files changed, 226 insertions(+), 205 deletions(-) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..9e92561c --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,220 @@ +name: "Java CI" +on: + push: + branches: + - '[6-9]+.[0-9]+.x' + pull_request: + branches: + - '[6-9]+.[0-9]+.x' + workflow_dispatch: +jobs: + build: + name: "Build Project" + runs-on: ubuntu-latest + strategy: + matrix: + java: ['11', '17'] + steps: + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'liberica' + java-version: ${{ matrix.java }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "🔨 Run Build" + id: build + 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 }} + run: ./gradlew build + - name: "✅ Verify CLI" + if: success() + run: | + cp grails-cli/build/distributions/grails-cli-*.zip cli.zip + unzip cli -d tmp + mv tmp/grails-cli-* tmp/cli + ./tmp/cli/bin/grails --version + - name: "📤 Publish to Sonatype OSSRH" + id: publish + if: success() && github.event_name == 'push' && matrix.java == '11' + 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 }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + run: ./gradlew publishToSonatype + linux: + name: "Build Linux Native CLI" + runs-on: ubuntu-latest + needs: build + steps: + - name: "📥 Checkout the repository" + uses: actions/checkout@v4 + - name: "☕️ Setup GraalVM CE" + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17' + distribution: 'graalvm-community' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "📸 Build the Native Image" + 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 }} + run: ./gradlew grails-cli:nativeCompile --no-daemon + - name: "✅ Verify Build" + run: ./grails-cli/build/native/nativeCompile/grails --version + - name: "✅ Verify Create App" + run: ./grails-cli/build/native/nativeCompile/grails create-app test + - name: "📦 Package Build" + env: + VERSION: ${{ github.event.release.tag_name }} + run: | + mkdir -p grails-linux-amd64-snapshot/bin + mv ./grails-cli/build/native/nativeCompile/grails grails-linux-amd64-snapshot/bin + cp ./LICENSE grails-linux-amd64-snapshot/ + zip -r grails-linux-amd64-snapshot.zip ./grails-linux-amd64-snapshot + - name: "📤 Upload Artifact to Workflow Summary Page" + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' + uses: actions/upload-artifact@v4 + with: + name: grails-linux-amd64-snapshot + path: grails-linux-amd64-snapshot.zip + macos: + name: "Build OS X Intel Native CLI" + runs-on: macos-13 + needs: build + steps: + - name: "📥 Checkout the repository" + uses: actions/checkout@v4 + - name: "☕️ Setup GraalVM CE" + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17' + distribution: 'graalvm-community' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "📸 Build the Native Image" + 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 }} + run: ./gradlew grails-cli:nativeCompile --no-daemon + - name: "✅ Verify Build" + run: ./grails-cli/build/native/nativeCompile/grails --version + - name: "✅ Verify Create App" + run: ./grails-cli/build/native/nativeCompile/grails create-app test + - name: "📦 Package Build" + env: + VERSION: ${{ github.event.release.tag_name }} + run: | + mkdir -p grails-darwin-amd64-snapshot/bin + mv ./grails-cli/build/native/nativeCompile/grails grails-darwin-amd64-snapshot/bin + cp ./LICENSE grails-darwin-amd64-snapshot/ + zip -r grails-darwin-amd64-snapshot.zip ./grails-darwin-amd64-snapshot -x '*.DS_Store*' -x '__MAC_OSX' + - name: "📤 Upload Artifact to Workflow Summary Page" + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' + uses: actions/upload-artifact@v4 + with: + name: grails-darwin-amd64-snapshot + path: grails-darwin-amd64-snapshot.zip + macos-arm: + name: "Build OS X Arm Native CLI" + runs-on: macos-latest + needs: [build] + steps: + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup GraalVM CE" + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17' + distribution: 'graalvm-community' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "📸 Build the Native Image" + 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 }} + run: ./gradlew grails-cli:nativeCompile --no-daemon + - name: "✅ Verify Build" + run: ./grails-cli/build/native/nativeCompile/grails --version + - name: "✅ Verify Create App" + run: ./grails-cli/build/native/nativeCompile/grails create-app test + - name: "📦 Package Build" + env: + VERSION: ${{ github.event.release.tag_name }} + run: | + mkdir -p grails-darwin-aarch64-snapshot/bin + mv ./grails-cli/build/native/nativeCompile/grails grails-darwin-aarch64-snapshot/bin + cp ./LICENSE grails-darwin-aarch64-snapshot/ + zip -r grails-darwin-aarch64-snapshot.zip grails-darwin-aarch64-snapshot/ -x '*.DS_Store*' -x '__MAC_OSX' + - name: "📤 Upload Artifact to Workflow Summary Page" + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' + uses: actions/upload-artifact@v4 + with: + name: grails-darwin-aarch64-snapshot + path: grails-darwin-aarch64-snapshot.zip + windows: + name: "Build Windows Native CLI" + runs-on: windows-latest + needs: build + steps: + - name: "📥 Checkout the repository" + uses: actions/checkout@v4 + - name: "☕️ Setup GraalVM CE" + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17' + distribution: 'graalvm-community' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "📸 Build the Native Image" + 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 }} + run: ./gradlew grails-cli:nativeCompile --no-daemon + - name: "✅ Verify Build (Powershell)" + shell: powershell + run: ./grails-cli/build/native/nativeCompile/grails.exe --version + - name: "✅ Verify Create App (Powershell)" + shell: powershell + run: ./grails-cli/build/native/nativeCompile/grails.exe create-app test + - name: "✅ Verify Build (CMD)" + shell: cmd + run: grails-cli\\build\\native\\nativeCompile\\grails --version + - name: "✅ Verify Create App (CMD)" + shell: cmd + run: grails-cli\\build\\native\\nativeCompile\\grails create-app test2 + - name: "📦 ZIP Archive" + run: | + New-Item "./grails-win-amd64-snapshot/bin" -ItemType Directory -ea 0 + Move-Item -Path ./grails-cli/build/native/nativeCompile/grails.exe -Destination "./grails-win-amd64-snapshot/bin" + Copy-Item "./LICENSE" -Destination "./grails-win-amd64-snapshot" + Compress-Archive -Path "./grails-win-amd64-snapshot" -Update -DestinationPath ./grails-win-amd64-snapshot.zip + - name: "📤 Upload Artifact to Workflow Summary Page" + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' + uses: actions/upload-artifact@v4 + with: + name: grails-win-amd64-snapshot + path: ./grails-win-amd64-snapshot.zip \ No newline at end of file diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 076c6679..aa8925c5 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -1,19 +1,10 @@ -name: "Snapshot" +name: "Snapshot GCP Deploy" on: - push: - branches: - - '[6-9]+.[0-9]+.x' - pull_request: - branches: - - '[6-9]+.[0-9]+.x' workflow_dispatch: jobs: build: name: "Build Project" runs-on: ubuntu-latest - strategy: - matrix: - java: ['11', '17'] steps: - name: "📥 Checkout repository" uses: actions/checkout@v4 @@ -21,7 +12,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'liberica' - java-version: ${{ matrix.java }} + java-version: '11' - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: @@ -32,26 +23,8 @@ jobs: DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} run: ./gradlew build - - name: "✅ Verify CLI" - if: success() - run: | - cp grails-cli/build/distributions/grails-cli-*.zip cli.zip - unzip cli -d tmp - mv tmp/grails-cli-* tmp/cli - ./tmp/cli/bin/grails --version - - name: "📤 Publish to Sonatype OSSRH" - id: publish - if: success() && github.event_name == 'push' && matrix.java == '11' - 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 }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - run: ./gradlew publishToSonatype deploy: - # Snapshots should only be deployed from the latest release branch - # as it updates the snapshot version on https://start.grails.org. - if: false # github.event_name != 'pull_request' + if: github.event_name != 'pull_request' name: "Deploy To Google Cloud Run" runs-on: ubuntu-latest needs: build @@ -72,7 +45,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'liberica' - java-version: '17' + java-version: '11' - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: @@ -112,9 +85,7 @@ jobs: --allow-unauthenticated --service-account=${{ secrets.GCLOUD_EMAIL }} deployAnalytics: - # Snapshots should only be deployed from the latest release branch - # as it updates the snapshot version on https://start.grails.org. - if: false # github.event_name != 'pull_request' + if: github.event_name != 'pull_request' name: "Deploy Analytics To Google Cloud Run" runs-on: ubuntu-latest needs: build @@ -135,7 +106,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'liberica' - java-version: '17' + java-version: '11' - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: @@ -166,173 +137,3 @@ jobs: run: | gcloud components install beta --quiet gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-analytics-snapshot --image $IMAGE_NAME --region us-central1 --platform managed --allow-unauthenticated --service-account=${{ secrets.GCLOUD_EMAIL }} - linux: - name: "Build Linux Native CLI" - runs-on: ubuntu-latest - needs: build - steps: - - name: "📥 Checkout the repository" - uses: actions/checkout@v4 - - name: "☕️ Setup GraalVM CE" - uses: graalvm/setup-graalvm@v1 - with: - java-version: '17' - distribution: 'graalvm-community' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "🐘 Setup Gradle" - uses: gradle/actions/setup-gradle@v4 - with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: "📸 Build the Native Image" - 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 }} - run: ./gradlew grails-cli:nativeCompile --no-daemon - - name: "✅ Verify Build" - run: ./grails-cli/build/native/nativeCompile/grails --version - - name: "✅ Verify Create App" - run: ./grails-cli/build/native/nativeCompile/grails create-app test - - name: "📦 Package Build" - env: - VERSION: ${{ github.event.release.tag_name }} - run: | - mkdir -p grails-linux-amd64-snapshot/bin - mv ./grails-cli/build/native/nativeCompile/grails grails-linux-amd64-snapshot/bin - cp ./LICENSE grails-linux-amd64-snapshot/ - zip -r grails-linux-amd64-snapshot.zip ./grails-linux-amd64-snapshot - - name: "📤 Upload Artifact to Workflow Summary Page" - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' - uses: actions/upload-artifact@v4 - with: - name: grails-linux-amd64-snapshot - path: grails-linux-amd64-snapshot.zip - macos: - name: "Build OS X Intel Native CLI" - runs-on: macos-13 - needs: build - steps: - - name: "📥 Checkout the repository" - uses: actions/checkout@v4 - - name: "☕️ Setup GraalVM CE" - uses: graalvm/setup-graalvm@v1 - with: - java-version: '17' - distribution: 'graalvm-community' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "🐘 Setup Gradle" - uses: gradle/actions/setup-gradle@v4 - with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: "📸 Build the Native Image" - 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 }} - run: ./gradlew grails-cli:nativeCompile --no-daemon - - name: "✅ Verify Build" - run: ./grails-cli/build/native/nativeCompile/grails --version - - name: "✅ Verify Create App" - run: ./grails-cli/build/native/nativeCompile/grails create-app test - - name: "📦 Package Build" - env: - VERSION: ${{ github.event.release.tag_name }} - run: | - mkdir -p grails-darwin-amd64-snapshot/bin - mv ./grails-cli/build/native/nativeCompile/grails grails-darwin-amd64-snapshot/bin - cp ./LICENSE grails-darwin-amd64-snapshot/ - zip -r grails-darwin-amd64-snapshot.zip ./grails-darwin-amd64-snapshot -x '*.DS_Store*' -x '__MAC_OSX' - - name: "📤 Upload Artifact to Workflow Summary Page" - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' - uses: actions/upload-artifact@v4 - with: - name: grails-darwin-amd64-snapshot - path: grails-darwin-amd64-snapshot.zip - macos-arm: - name: "Build OS X Arm Native CLI" - runs-on: macos-latest - needs: [build] - steps: - - name: "📥 Checkout repository" - uses: actions/checkout@v4 - - name: "☕️ Setup GraalVM CE" - uses: graalvm/setup-graalvm@v1 - with: - java-version: '17' - distribution: 'graalvm-community' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "🐘 Setup Gradle" - uses: gradle/actions/setup-gradle@v4 - with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: "📸 Build the Native Image" - 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 }} - run: ./gradlew grails-cli:nativeCompile --no-daemon - - name: "✅ Verify Build" - run: ./grails-cli/build/native/nativeCompile/grails --version - - name: "✅ Verify Create App" - run: ./grails-cli/build/native/nativeCompile/grails create-app test - - name: "📦 Package Build" - env: - VERSION: ${{ github.event.release.tag_name }} - run: | - mkdir -p grails-darwin-aarch64-snapshot/bin - mv ./grails-cli/build/native/nativeCompile/grails grails-darwin-aarch64-snapshot/bin - cp ./LICENSE grails-darwin-aarch64-snapshot/ - zip -r grails-darwin-aarch64-snapshot.zip grails-darwin-aarch64-snapshot/ -x '*.DS_Store*' -x '__MAC_OSX' - - name: "📤 Upload Artifact to Workflow Summary Page" - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' - uses: actions/upload-artifact@v4 - with: - name: grails-darwin-aarch64-snapshot - path: grails-darwin-aarch64-snapshot.zip - windows: - name: "Build Windows Native CLI" - runs-on: windows-latest - needs: build - steps: - - name: "📥 Checkout the repository" - uses: actions/checkout@v4 - - name: "☕️ Setup GraalVM CE" - uses: graalvm/setup-graalvm@v1 - with: - java-version: '17' - distribution: 'graalvm-community' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: "🐘 Setup Gradle" - uses: gradle/actions/setup-gradle@v4 - with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: "📸 Build the Native Image" - 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 }} - run: ./gradlew grails-cli:nativeCompile --no-daemon - - name: "✅ Verify Build (Powershell)" - shell: powershell - run: ./grails-cli/build/native/nativeCompile/grails.exe --version - - name: "✅ Verify Create App (Powershell)" - shell: powershell - run: ./grails-cli/build/native/nativeCompile/grails.exe create-app test - - name: "✅ Verify Build (CMD)" - shell: cmd - run: grails-cli\\build\\native\\nativeCompile\\grails --version - - name: "✅ Verify Create App (CMD)" - shell: cmd - run: grails-cli\\build\\native\\nativeCompile\\grails create-app test2 - - name: "📦 ZIP Archive" - run: | - New-Item "./grails-win-amd64-snapshot/bin" -ItemType Directory -ea 0 - Move-Item -Path ./grails-cli/build/native/nativeCompile/grails.exe -Destination "./grails-win-amd64-snapshot/bin" - Copy-Item "./LICENSE" -Destination "./grails-win-amd64-snapshot" - Compress-Archive -Path "./grails-win-amd64-snapshot" -Update -DestinationPath ./grails-win-amd64-snapshot.zip - - name: "📤 Upload Artifact to Workflow Summary Page" - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/6.0.x' - uses: actions/upload-artifact@v4 - with: - name: grails-win-amd64-snapshot - path: ./grails-win-amd64-snapshot.zip \ No newline at end of file From 914afecc12db2ac0e3ce7b76111eeed40de6bd2e Mon Sep 17 00:00:00 2001 From: James Fredley Date: Tue, 10 Dec 2024 13:53:21 -0500 Subject: [PATCH 02/10] rename snapshot.yml to snapshot-gcp-deploy.yml --- .github/workflows/{snapshot.yml => snapshot-gcp-deploy.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{snapshot.yml => snapshot-gcp-deploy.yml} (100%) diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot-gcp-deploy.yml similarity index 100% rename from .github/workflows/snapshot.yml rename to .github/workflows/snapshot-gcp-deploy.yml From b3d50aaccbdb3cb17ff6de89ee8ffaed6f50156d Mon Sep 17 00:00:00 2001 From: James Fredley Date: Tue, 10 Dec 2024 13:54:07 -0500 Subject: [PATCH 03/10] Split release GPC deploy into release-gcp-deploy.yml --- .github/workflows/release-gcp-deploy.yml | 153 +++++++++++++++++++++++ .github/workflows/release.yml | 125 +----------------- 2 files changed, 154 insertions(+), 124 deletions(-) create mode 100644 .github/workflows/release-gcp-deploy.yml diff --git a/.github/workflows/release-gcp-deploy.yml b/.github/workflows/release-gcp-deploy.yml new file mode 100644 index 00000000..622d90d1 --- /dev/null +++ b/.github/workflows/release-gcp-deploy.yml @@ -0,0 +1,153 @@ +name: "Release GCP Deploy" +on: + workflow_dispatch: +jobs: + build: + name: "Build Project" + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + release_version: ${{ steps.release_version.outputs.value }} + env: + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' + steps: + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + - name: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'liberica' + java-version: '11' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "🔨 Build All" + 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 }} + run: ./gradlew grails-cli:assemble + deploy: + name: "Deploy To Google Cloud Run" + runs-on: ubuntu-latest + needs: build + steps: + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + with: + ref: v${{ needs.build.outputs.release_version }} + - name: "🔑 Login to Google Cloud" + 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: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'liberica' + java-version: '11' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "✅ Run Tests" + 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 }} + run: > + ./gradlew + 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. + env: + IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }} + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: > + ./gradlew + grails-forge-web-netty:dockerBuildNative + -PdockerImageName=${{ env.IMAGE_NAME }} + - name: "📤 Push image to Google Cloud Container Registry" + env: + IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }} + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: > + ./gradlew + 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 + steps: + - name: "📥 Checkout repository" + uses: actions/checkout@v4 + with: + ref: v${{ needs.build.outputs.release_version }} + - 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: "☕️ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: 'liberica' + java-version: '11' + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "✅ Run Tests" + 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 }} + run: > + ./gradlew + grails-forge-analytics-postgres: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. + env: + IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ needs.build.outputs.release_version }} + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: > + ./gradlew + grails-forge-analytics-postgres:dockerBuildNative + -PdockerImageName=${{ env.IMAGE_NAME }} + - name: "📤 Push image to Google Cloud Container Registry" + env: + IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ needs.build.outputs.release_version }} + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: > + ./gradlew + 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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45c72266..983167c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,6 @@ name: "Release" on: - release: - types: [published] + workflow_dispatch: jobs: build: name: "Release artifacts to Bintray, Maven Central & SDKMAN, and publish documentation" @@ -111,128 +110,6 @@ jobs: 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 - steps: - - name: "📥 Checkout repository" - uses: actions/checkout@v4 - with: - ref: v${{ needs.build.outputs.release_version }} - - name: "🔑 Login to Google Cloud" - 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: "☕️ Setup JDK" - uses: actions/setup-java@v4 - with: - distribution: 'liberica' - java-version: '11' - - name: "🐘 Setup Gradle" - uses: gradle/actions/setup-gradle@v4 - with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: "✅ Run Tests" - 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 }} - run: > - ./gradlew - 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. - env: - IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }} - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - run: > - ./gradlew - grails-forge-web-netty:dockerBuildNative - -PdockerImageName=${{ env.IMAGE_NAME }} - - name: "📤 Push image to Google Cloud Container Registry" - env: - IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }} - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - run: > - ./gradlew - 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 - steps: - - name: "📥 Checkout repository" - uses: actions/checkout@v4 - with: - ref: v${{ needs.build.outputs.release_version }} - - 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: "☕️ Setup JDK" - uses: actions/setup-java@v4 - with: - distribution: 'liberica' - java-version: '11' - - name: "🐘 Setup Gradle" - uses: gradle/actions/setup-gradle@v4 - with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: "✅ Run Tests" - 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 }} - run: > - ./gradlew - grails-forge-analytics-postgres: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. - env: - IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ needs.build.outputs.release_version }} - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - run: > - ./gradlew - grails-forge-analytics-postgres:dockerBuildNative - -PdockerImageName=${{ env.IMAGE_NAME }} - - name: "📤 Push image to Google Cloud Container Registry" - env: - IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ needs.build.outputs.release_version }} - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - run: > - ./gradlew - 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 From acbdc3c6fef14ec3185112cb8fe86c49b2c8efde Mon Sep 17 00:00:00 2001 From: James Fredley Date: Tue, 10 Dec 2024 13:56:48 -0500 Subject: [PATCH 04/10] fix release trigger --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 983167c0..f4f41216 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: "Release" on: - workflow_dispatch: + release: + types: [published] jobs: build: name: "Release artifacts to Bintray, Maven Central & SDKMAN, and publish documentation" From 3bfea4ebbc56673d102b4404c2ae85d398a24b47 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Tue, 10 Dec 2024 14:06:56 -0500 Subject: [PATCH 05/10] Update release_version and require input when manually running --- .github/workflows/release-gcp-deploy.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-gcp-deploy.yml b/.github/workflows/release-gcp-deploy.yml index 622d90d1..b9718f72 100644 --- a/.github/workflows/release-gcp-deploy.yml +++ b/.github/workflows/release-gcp-deploy.yml @@ -1,6 +1,10 @@ name: "Release GCP Deploy" on: workflow_dispatch: + inputs: + release: + description: 'Release version' + required: true jobs: build: name: "Build Project" @@ -8,7 +12,7 @@ jobs: permissions: contents: write outputs: - release_version: ${{ steps.release_version.outputs.value }} + release_version: ${{ github.event.inputs.release }} env: GIT_USER_NAME: 'grails-build' GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' From bd738f564c7d8b51c4d719c9d4c3f1183c986579 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 11 Dec 2024 15:45:48 -0500 Subject: [PATCH 06/10] remove unneeded condition on snapshot GCP workflow --- .github/workflows/snapshot-gcp-deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/snapshot-gcp-deploy.yml b/.github/workflows/snapshot-gcp-deploy.yml index aa8925c5..e0a70a90 100644 --- a/.github/workflows/snapshot-gcp-deploy.yml +++ b/.github/workflows/snapshot-gcp-deploy.yml @@ -24,7 +24,6 @@ jobs: DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} run: ./gradlew build deploy: - if: github.event_name != 'pull_request' name: "Deploy To Google Cloud Run" runs-on: ubuntu-latest needs: build @@ -85,7 +84,6 @@ jobs: --allow-unauthenticated --service-account=${{ secrets.GCLOUD_EMAIL }} deployAnalytics: - if: github.event_name != 'pull_request' name: "Deploy Analytics To Google Cloud Run" runs-on: ubuntu-latest needs: build From 96b429397379af96bcba6b42e3cfb8c86abb01d4 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 11 Dec 2024 15:46:15 -0500 Subject: [PATCH 07/10] update deployAnalytics to camel case --- .github/workflows/release-gcp-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-gcp-deploy.yml b/.github/workflows/release-gcp-deploy.yml index b9718f72..dee08347 100644 --- a/.github/workflows/release-gcp-deploy.yml +++ b/.github/workflows/release-gcp-deploy.yml @@ -94,7 +94,7 @@ jobs: 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: + deployAnalytics: name: "Deploy Analytics To Google Cloud Run" runs-on: ubuntu-latest needs: build From d542dabc9c3f461b43a02a622e6c0292e51f7083 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 11 Dec 2024 15:46:44 -0500 Subject: [PATCH 08/10] Update step name and remove comment --- .github/workflows/release-gcp-deploy.yml | 6 ++---- .github/workflows/snapshot-gcp-deploy.yml | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-gcp-deploy.yml b/.github/workflows/release-gcp-deploy.yml index dee08347..c9b83647 100644 --- a/.github/workflows/release-gcp-deploy.yml +++ b/.github/workflows/release-gcp-deploy.yml @@ -67,8 +67,7 @@ jobs: ./gradlew 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. + - name: "🔨 Build Docker Native Image" env: IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ needs.build.outputs.release_version }} DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} @@ -127,8 +126,7 @@ jobs: run: > ./gradlew grails-forge-analytics-postgres: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. + - name: "🔨 Build Docker Native Image" env: IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ needs.build.outputs.release_version }} DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} diff --git a/.github/workflows/snapshot-gcp-deploy.yml b/.github/workflows/snapshot-gcp-deploy.yml index e0a70a90..b55f4987 100644 --- a/.github/workflows/snapshot-gcp-deploy.yml +++ b/.github/workflows/snapshot-gcp-deploy.yml @@ -57,8 +57,7 @@ jobs: ./gradlew 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. + - name: "🔨 Build Docker Native Image" 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 }} @@ -114,8 +113,7 @@ jobs: DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} run: ./gradlew grails-forge-analytics-postgres: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. + - name: "🔨 Build Docker Native Image" 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 }} From e8c934c45172f0d473b8fe4074a47f03a5d48559 Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 11 Dec 2024 15:54:30 -0500 Subject: [PATCH 09/10] remove deploy.yml github workflow which is replaced by release-gcp-deploy.yml --- .github/workflows/deploy.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 03a91654..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Manual Deploy to GCP -on: - workflow_dispatch: - inputs: - release: - description: 'Release version' - required: true -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - 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: Deploy Docker image - env: - release_version: ${{ github.event.inputs.release }} - IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}:${{ github.event.inputs.release }} - run: | - gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-latest --image $IMAGE_NAME --region us-central1 --update-env-vars=HOSTNAME="grailsforge-latest-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 }} - 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 }} \ No newline at end of file From a24ca2cd575d33a9b2efac93fb23778e291e741c Mon Sep 17 00:00:00 2001 From: James Fredley Date: Wed, 11 Dec 2024 15:55:16 -0500 Subject: [PATCH 10/10] rename file prev.yml to prev-gcp-deploy.yml and change name to Prev GCP Deploy --- .github/workflows/{prev.yml => prev-gcp-deploy.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{prev.yml => prev-gcp-deploy.yml} (99%) diff --git a/.github/workflows/prev.yml b/.github/workflows/prev-gcp-deploy.yml similarity index 99% rename from .github/workflows/prev.yml rename to .github/workflows/prev-gcp-deploy.yml index f939505a..9d57d32c 100644 --- a/.github/workflows/prev.yml +++ b/.github/workflows/prev-gcp-deploy.yml @@ -1,4 +1,4 @@ -name: "Prev" +name: "Prev GCP Deploy" on: workflow_dispatch: jobs: