Redeploy functions #59
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
# If you change this file make sure to change the references to filename and outputs from | |
# functions and website workflows | |
name: Clean up PR | |
on: | |
pull_request: | |
types: | |
- "closed" | |
jobs: | |
deploy_vars: | |
secrets: inherit | |
uses: ./.github/workflows/prepare-deploy.yml | |
with: | |
wait: false | |
# deploy_env: ${{ inputs.deploy_env }} | |
cleanup: | |
runs-on: ubuntu-latest | |
needs: deploy_vars | |
permissions: | |
contents: read | |
id-token: write | |
actions: read | |
checks: read | |
statuses: read | |
deployments: read | |
environment: gcloud-dev | |
steps: | |
# Assume a PR won't be closed unless the deployments are finished | |
# because this wait functions will fail if developers delete the branch | |
# before this wait-on-check-action run (30s-2min) | |
# - name: wait for function-deploy jobs to finish | |
# uses: lewagon/[email protected] | |
# continue-on-error: true | |
# with: | |
# ref: ${{ github.head_ref || github.ref }} | |
# check-name: 'deploy-functions' | |
# repo-token: ${{ secrets.GITHUB_TOKEN }} | |
# wait-interval: 10 | |
# - name: wait for web-deploy jobs to finish | |
# uses: lewagon/[email protected] | |
# continue-on-error: true | |
# with: | |
# ref: ${{ github.head_ref || github.ref }} | |
# check-name: 'publish-to-gcs' | |
# repo-token: ${{ secrets.GITHUB_TOKEN }} | |
# wait-interval: 10 | |
- name: Auth gcloud | |
id: gauth | |
uses: google-github-actions/auth@ef5d53e30bbcd8d0836f4288f5e50ff3e086997d # @v1 | |
with: | |
workload_identity_provider: '${{ secrets.GWIP }}' | |
service_account: '${{ secrets.GSA }}' | |
# Install gcloud, `setup-gcloud` automatically picks up authentication from `auth`. | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: Delete Function created on PR | |
run: gcloud functions delete --region ${{ vars.GCP_REGION }} ${{ needs.deploy_vars.outputs.function_name }} | |
- name: delete the bucket if PR is closed' | |
run: gsutil -m rm -r gs://${{ needs.deploy_vars.outputs.bucket_url }} |