-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (31 loc) · 1.01 KB
/
google.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
name: Google Cloud
on:
push:
branches: [ main ]
paths-ignore:
- '.github/**'
- '**.md'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Authenticate with Google Cloud
id: auth
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Deploy to App Engine
uses: google-github-actions/deploy-appengine@v0.8.0
with:
deliverables: app.yaml
- name: Delete old versions in App Engine
run: |
INSTANCE_TYPE="default"
VERSIONS_TO_KEEP=1
VERSIONS=`gcloud app versions list --service $INSTANCE_TYPE --sort-by '~version' --format 'value(version.id)' | sort -r | tail -n +$(($VERSIONS_TO_KEEP + 1)) | paste -sd " " -`
if [ ${#VERSIONS} -gt 0 ]; then
delete_cmd="gcloud app versions delete --service $INSTANCE_TYPE $VERSIONS -q" && eval $delete_cmd;
fi