Setup frontend deployment github action
This commit is contained in:
parent
722750b2be
commit
4382f559f3
39
.github/workflows/deploy_frontend.yml
vendored
Normal file
39
.github/workflows/deploy_frontend.yml
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
name: Deploy Frontend
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
paths: ['crabfit-frontend/**']
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: crabfit-frontend
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 17
|
||||
cache: yarn
|
||||
cache-dependency-path: '**/yarn.lock'
|
||||
- run: yarn install --immutable
|
||||
- run: yarn build
|
||||
- name: Copy app.yaml to build
|
||||
run: 'cp app.yaml ./build/app.yaml'
|
||||
- id: auth
|
||||
uses: google-github-actions/auth@v0
|
||||
with:
|
||||
credentials_json: '${{ secrets.GCP_SA_KEY }}'
|
||||
- id: deploy
|
||||
uses: google-github-actions/deploy-appengine@v0
|
||||
with:
|
||||
working_directory: crabfit-frontend/build
|
||||
version: v1
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
yarn build
|
||||
|
||||
cd build
|
||||
|
||||
cat > app.yaml << EOF
|
||||
runtime: nodejs12
|
||||
handlers:
|
||||
- url: /(.*\..+)$
|
||||
static_files: \1
|
||||
upload: (.*\..+)$
|
||||
secure: always
|
||||
redirect_http_response_code: 301
|
||||
|
||||
- url: /.*
|
||||
static_files: index.html
|
||||
upload: index.html
|
||||
secure: always
|
||||
redirect_http_response_code: 301
|
||||
EOF
|
||||
|
||||
gcloud app deploy --project=crabfit --version=v1
|
||||
Loading…
Reference in a new issue