Skip to content

Commit

Permalink
Update deploy-to-production.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
discombobulateme committed May 2, 2024
1 parent 87c0634 commit ad542a7
Showing 1 changed file with 33 additions and 91 deletions.
124 changes: 33 additions & 91 deletions .github/workflows/deploy-to-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ on:

env:
NO_INDEX: true
ALGOLIA_APP_ID: ${{secrets.ALGOLIA_APP_ID}}
ALGOLIA_KEY: ${{secrets.ALGOLIA_KEY}}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}

jobs:
build:
Expand All @@ -26,128 +26,70 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18

node-version: 18
- uses: actions/cache@v2
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
run: npm install
- uses: actions/cache@v2
id: cache-build
with:
path: |
build
path: build
key: ${{ runner.os }}-${{ github.sha }}

- name: Run Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
npm run build
run: npm run build

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

job_id:
# Add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
if: github.ref == 'refs/heads/main'
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- run: pip install crcmod

- id: 'auth'
uses: 'google-github-actions/auth@v2'
node-version: 18
- uses: google-github-actions/auth@v2
with:
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'
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
- uses: google-github-actions/setup-gcloud@v2
with:
version: '>= 290.0.1'

- uses: actions/cache@v2
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 }}
version: '>= 363.0.0'
- run: npm install
- run: npm run build
- run: gsutil -m rsync -R -d . ${{ secrets.GCS_BUCKET }}

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

if: github.ref == 'refs/heads/main'
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v41
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Python
uses: actions/setup-python@v2
node-version: 18
- uses: google-github-actions/auth@v2
with:
python-version: 3.7
- run: pip install crcmod

- id: 'auth'
uses: 'google-github-actions/auth@v2'
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
- uses: google-github-actions/setup-gcloud@v2
with:
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: '>= 290.0.1'

- name: Install Dependencies
# if: steps.cache-build.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_PROD_BUCKET }}
version: '>= 363.0.0'
- run: npm install
- run: npm run build
- run: gsutil -m rsync -R -d . ${{ secrets.GCS_PROD_BUCKET }}

0 comments on commit ad542a7

Please sign in to comment.