Skip to content

Commit

Permalink
Auto drop old app versions on deploy (#305)
Browse files Browse the repository at this point in the history
* Auto drop old app versions on deploy

eh use 5

eh use 5

* no need to run tests on pull request
  • Loading branch information
nolanbconaway authored Oct 24, 2023
1 parent 78df0d5 commit 40f9af8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: 'auth'
- name: Authorize to Google Cloud
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_SERVICE_ACCOUNT_CREDENTIALS_JSON }}'
- id: 'deploy'

- name: Deploy to App Engine
id: deploy
uses: google-github-actions/deploy-appengine@v1

# Quick HTTP test
- id: test
- name: cURL Test
run: curl "${{ steps.deploy.outputs.url }}"

- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'

- name: Delete Old App Versions
# delete all but latest 5 versions
run: |
gcloud app versions list \
--format="value(version.id)" \
--sort-by="~version.createTime" \
| tail -n +5 \
| xargs -r gcloud app versions delete --quiet
# make sure we didn't delete the current version
- name: cURL Test
run: curl "${{ steps.deploy.outputs.url }}"
2 changes: 1 addition & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Lint and 100% Test Coverage

on: [push, pull_request]
on: push

jobs:
run:
Expand Down

0 comments on commit 40f9af8

Please sign in to comment.