prevent double writes to worker in GCS, port to newer GCP auth workflow

This commit is contained in:
41666 2022-01-30 17:32:14 -05:00
parent c38e1b129a
commit 9ae9c104ef

View file

@ -49,17 +49,21 @@ jobs:
with: with:
node-version: '16' node-version: '16'
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCS_TF_KEY }}'
- name: Set up Cloud SDK - name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master uses: google-github-actions/setup-gcloud@v0
with: with:
project_id: ${{ secrets.GCS_PROJECT_ID }} project_id: ${{ secrets.GCS_PROJECT_ID }}
service_account_key: ${{ secrets.GCS_TF_KEY }}
export_default_credentials: true export_default_credentials: true
- name: Check if already deployed - name: Check if already deployed
id: check id: check
run: | run: |
gsutil stat gs://roleypoly-artifacts/workers/${{ github.sha }}/${{ matrix.worker }}.js \ gsutil stat gs://roleypoly-artifacts/workers/${{ github.sha }}/index.mjs \
&& echo ::set-output name=skip::1 \ && echo ::set-output name=skip::1 \
|| echo ::set-output name=skip::0 || echo ::set-output name=skip::0
@ -90,7 +94,6 @@ jobs:
with: with:
path: packages/api/dist/index.mjs path: packages/api/dist/index.mjs
destination: roleypoly-artifacts/workers/${{ github.sha }} destination: roleypoly-artifacts/workers/${{ github.sha }}
credentials: ${{ secrets.GCS_TF_KEY }}
docker_build: docker_build:
name: Docker Build & Publish name: Docker Build & Publish
@ -159,7 +162,7 @@ jobs:
needs: needs:
- docker_build - docker_build
- worker_build - worker_build
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/miniflare'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get Bot digest - name: Get Bot digest