👷 Pre build steps and new pull requests CI #8
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: 'Deploy' | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
terraform: | |
name: 'Deploy' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Authenticate to GCP | |
id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
token_format: access_token | |
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
- name: Install dependencies | |
id: deps | |
run: npm ci | |
- name: Build | |
id: build | |
run: npm run build | |
- name: List building output | |
id: list-output | |
run: ls -l out | |
- name: Clear bucket | |
id: clear | |
run: gcloud storage rm -c gs://${{ secrets.GCP_STORAGE_BUCKET_NAME }}/** || true | |
- name: Deploy | |
id: deploy | |
run: gcloud storage cp -c -r out/* gs://${{ secrets.GCP_STORAGE_BUCKET_NAME }} | |
- name: Update permissions | |
id: permissions | |
run: gcloud storage objects update -r gs://${{ secrets.GCP_STORAGE_BUCKET_NAME }}/* --add-acl-grant=entity=AllUsers,role=READER |