Skip to content

Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json from 1.7.0 to 1.7.1 #59

Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json from 1.7.0 to 1.7.1

Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json from 1.7.0 to 1.7.1 #59

name: "Deploy to Google App Engine"
on:
pull_request:
push:
branches:
- release
workflow_dispatch:
inputs:
production:
description: 'Deploy to production?'
required: true
type: boolean
default: false
jobs:
validate:
name: "🦺 Validation"
uses: TWiStErRob/github-workflows/.github/workflows/validate.yml@1e06403c5d561d70e40109c2701ea3092ca6ded7 # v3
permissions:
contents: read
security-events: write
actions: read
filter:
name: "Detect changes"
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 2
permissions:
# actions/checkout
contents: read
# tj-actions/changed-files
pull-requests: read
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: "Checkout ${{ github.ref }} branch in ${{ github.repository }} repository."
uses: actions/checkout@v4
- name: "Find changes to unrelated paths."
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
- 'planner/**'
- '.github/workflows/planner-appengine-deploy.yml'
- '.github/workflows/planner-appengine-delete.yml'
outputs:
relevant-changes-exist: ${{ steps.changed-files.outputs.any_modified == 'true'}}
release:
name: "Release to Google App Engine"
needs:
- validate
- filter
if: ${{ always() && needs.validation.result == 'success' && (needs.filter.result == 'skipped' || needs.filter.outputs.relevant-changes-exist == 'true') }}
timeout-minutes: 10
env:
# Convert input toJSON, because in GitHub Actions: false == null == ''.
# Convert ternary true part toJSON, to make sure || is not trying to interpret it (toJSON(false) -> 'false' will be truthy).
RELEASE_TO_PRODUCTION: ${{ toJSON(inputs.production) == 'null' && toJSON(github.ref == 'refs/heads/release') || inputs.production }}
permissions:
contents: read # This is required for actions/checkout.
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#updating-your-actions-for-oidc
id-token: write # This is required for requesting the JWT via google-github-actions/auth.
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: "Determine Google App Engine version name."
id: name
uses: actions/github-script@v7
env:
INPUT_PROD: ${{ env.RELEASE_TO_PRODUCTION }}
with:
result-encoding: string
script: |
return process.env.INPUT_PROD === 'true'
// Use blank to indicate that this is a release to production and should use automatic naming.
? 'release'
: context.ref
// refs/heads/main from workflow_dispatch and push events.
.replace('refs/heads/', 'br-')
// refs/pull/123/merge from pull_request event.
.replace('refs/pull/', 'pr-')
// ERROR: (gcloud.app.deploy) argument --version/-v: Bad value [...]:
// May only contain lowercase letters, digits, and hyphens.
// Must begin and end with a letter or digit. Must not exceed 63 characters.
.replace(/[^a-z0-9-]/g, '-')
- name: "Checkout ${{ github.ref }} branch in ${{ github.repository }} repository."
uses: actions/checkout@v4
- name: "Set up Java."
uses: actions/setup-java@v4
with:
java-version-file: planner/.java-version
distribution: temurin
- name: "Set up Node."
uses: actions/setup-node@v4
with:
node-version-file: planner/package.json
- name: "Set up NPM 10.x."
# https://github.com/actions/setup-node/issues/324
run: npm install --global npm@10
- name: "Authenticate to Google Cloud."
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GAE_WIP }}
service_account: ${{ secrets.GAE_SA }}
- name: "Print tooling versions."
run: |
node -v
npm -v
java -version
gcloud --version
- name: "Build Frontend."
working-directory: planner
run: |
npm install
cd frontend
npm run build:prod
- name: "Build Backend."
working-directory: planner
run: >
./gradlew
:backend:endpoint:jar
- name: "Publish ${{ env.VERSION }} to Google App Engine (production=${{ env.RELEASE_TO_PRODUCTION }})."
working-directory: planner
env:
# Use pre-existing SDK, don't download a new one.
GCLOUD_HOME: /usr/lib/google-cloud-sdk
# Will be propagated to app.yml
NEO4J_URL: ${{ secrets.NEO4J_URL }}
VERSION: ${{ steps.name.outputs.result }}
run: >
./gradlew
:deploy:appengine:appengineDeploy
-Pnet.twisterrob.deploy.replaceLive="${RELEASE_TO_PRODUCTION}"
-Pnet.twisterrob.deploy.versionName="${VERSION}"