Skip to content

Attempt to detect content category #123

Attempt to detect content category

Attempt to detect content category #123

Workflow file for this run

name: Deploy app to GAE
on:
pull_request:
paths:
- "app/**"
- ".github/workflows/deploy_app.yml"
push:
branches:
- main
paths:
- "app/**"
- ".github/workflows/deploy_app.yml"
tags:
- "release-*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
MAIN: ${{ github.ref == 'refs/heads/main' }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
CONFIG_FILE: "app/app.yaml"
SERVICE: audiora-app
API_BASE_URL: ${{ secrets.API_BASE_URL }}
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('main-{0}', steps.prepare_env.outputs.SHORT_SHA) }}
TAGGED: ${{ steps.prepare_env.outputs.TAGGED }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: prepare_env
run: |
echo "TAGGED=${{ startsWith(github.ref, 'refs/tags/app') }}" >> $GITHUB_OUTPUT
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: prepare
timeout-minutes: 5
env:
VERSION: ${{ needs.prepare.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
- id: cache-app
uses: ./.github/actions/node_pnpm_cache
with:
cache-key: app-root-${{ hashFiles('**/pnpm-lock.yaml') }}
cache-paths: |
~/.cache/Cypress
- run: pnpm install --no-frozen-lockfile
if: steps.cache-app.outputs.cache-hit != 'true'
- uses: google-github-actions/auth@v2
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- run: pnpm sync
working-directory: app
- run: pnpm tsc
working-directory: app
- run: pnpm check
working-directory: app
- run: pnpm build
working-directory: app
- uses: actions/upload-artifact@v4
with:
name: app
path: |
app/build
app/${{ env.CONFIG_FILE }}
app/package.json
app/.svelte-kit/tsconfig.json
app/.gcloudignore
app/.dockerignore
app/.npmrc
pnpm-lock.yaml
deploy:
runs-on: ubuntu-latest
needs: [prepare, build]
timeout-minutes: 10
outputs:
healthcheck_outcome: ${{ steps.healthcheck.outcome }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/download-artifact@v4
with:
name: app
- uses: google-github-actions/auth@v2
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- id: deploy
uses: google-github-actions/deploy-appengine@v2
with:
project_id: ${{ env.PROJECT_ID }}
deliverables: ${{ env.CONFIG_FILE }}
promote: ${{ env.MAIN == 'true' }}
version: ${{ needs.prepare.outputs.VERSION }}
env_vars: |-
BODY_SIZE_LIMIT=Infinity
NODE_ENV=production
BUCKET_NAME=${{ secrets.BUCKET_NAME }}
CLOUD_STORAGE_BUCKET=${{ secrets.BUCKET_NAME }}
API_BASE_URL=${{ secrets.API_BASE_URL }}
- run: curl -f "${{ steps.deploy.outputs.url }}"
- uses: marocchino/sticky-pull-request-comment@v2
with:
header: app
message: |
app: ${{ steps.deploy.outputs.url }} (${{ github.event.pull_request.head.sha }})