-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (116 loc) · 3.54 KB
/
deploy_app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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 }})