Skip to content

Commit

Permalink
Auto drop old app versions on deploy
Browse files Browse the repository at this point in the history
eh use 5

eh use 5
  • Loading branch information
nolanbconaway committed Oct 24, 2023
1 parent 78df0d5 commit 3a38c0f
Showing 1 changed file with 21 additions and 4 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 }}"

0 comments on commit 3a38c0f

Please sign in to comment.