🔧 docker login-action v2->v3, fix gar removal #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Delete Cloud Run (PR closed) | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Login to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
token_format: access_token | |
workload_identity_provider: 'projects/292061085119/locations/global/workloadIdentityPools/github-pool/providers/provider-github' | |
service_account: 'gh-actions@ynufes-hp-cloudrun.iam.gserviceaccount.com' | |
- name: setup gcloud | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
version: '>= 363.0.0' | |
- name: Delete Cloud Run | |
id: delete-cloudrun-service | |
continue-on-error: true | |
run: | | |
gcloud run services delete tokiwa23-stg-pr-${{ github.event.number }} --region=asia-northeast1 --quiet | |
- name: Delete from Artifact Registry | |
id: delete-artifact-registry | |
continue-on-error: true | |
run: | | |
gcloud artifacts docker images delete asia-northeast1-docker.pkg.dev/ynufes-hp-cloudrun/staging/tokiwa23-pr-${{ github.event.number }} --quiet | |
- name: Notify Failure on Pull Request | |
if: ${{ steps.delete-cloudrun-service.outcome != 'success' || steps.delete-artifact-registry.outcome != 'success' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh pr comment ${{ github.event.number }} -m "Failed to delete resources, CloudRun: ${{ steps.delete-cloudrun-service.outcome }}, Artifact Registry: ${{ steps.delete-artifact-registry.outcome }}" | |
exit 1 |