Skip to content

Commit

Permalink
Merge pull request #2764 from saucelabs/discombobulateme-patch-1
Browse files Browse the repository at this point in the history
Trying to fix actions deployment
  • Loading branch information
Paloma Oliveira authored May 3, 2024
2 parents ad542a7 + 6d51028 commit a404904
Showing 1 changed file with 83 additions and 25 deletions.
108 changes: 83 additions & 25 deletions .github/workflows/deploy-to-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache@v2
node-version: 18.x

- uses: actions/cache@v4
id: cache-npm-packages
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}

- name: Install Dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm install
- uses: actions/cache@v2

- uses: actions/cache@v4
id: cache-build
with:
path: build
Expand All @@ -47,49 +50,104 @@ jobs:

deploy-staging:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: ${{ github.ref == 'refs/heads/main' }}

permissions:
contents: read
id-token: write
contents: 'read'
id-token: 'write'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: google-github-actions/auth@v2
node-version: 18.x

- name: Install Python
uses: actions/setup-python@v2
with:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
- uses: google-github-actions/setup-gcloud@v2
python-version: 3.7
- run: pip install crcmod

- name: Auth GCP
uses: 'google-github-actions/auth@v2'
with:
version: '>= 363.0.0'
- run: npm install
- run: npm run build
- run: gsutil -m rsync -R -d . ${{ secrets.GCS_BUCKET }}
workload_identity_provider: ${{ secrets.RUN_PROJECT }}
service_account: ${{ secrets.RUN_SA_KEY }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 290.0.1'

- name: 'Use gcloud CLI'
run: 'gcloud info'

- uses: actions/cache@v4
id: cache-build
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}

- name: Install Dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: |
npm install
- name: Run Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
npm run build
- name: Deploy to Bucket
run: |-
cd build
gsutil -m rsync -R -d . ${{ secrets.GCS_BUCKET }}
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: ${{ github.ref == 'refs/heads/main' }}
env:
NO_INDEX: false

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: google-github-actions/auth@v2
node-version: 18.x

- name: Auth GCP
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
- uses: google-github-actions/setup-gcloud@v2
workload_identity_provider: ${{ secrets.RUN_PROJECT_PROD }}
service_account: ${{ secrets.RUN_SA_KEY_PROD }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- run: npm install
- run: npm run build
- run: gsutil -m rsync -R -d . ${{ secrets.GCS_PROD_BUCKET }}
version: '>= 290.0.1'

- name: 'Use gcloud CLI'
run: 'gcloud info'

- name: Install Dependencies
run: |
npm install
- name: Run Build
run: |
npm run build
- name: Deploy to Bucket
run: |-
cd build
gsutil -m rsync -R -d . ${{ secrets.GCS_PROD_BUCKET }}

0 comments on commit a404904

Please sign in to comment.