Skip to content

Merge pull request #2439 from saucelabs/sc-sharing-table #2153

Merge pull request #2439 from saucelabs/sc-sharing-table

Merge pull request #2439 from saucelabs/sc-sharing-table #2153

name: Deploy to Production
on:
pull_request:
push:
branches:
- main
paths-ignore:
- '.github/**'
- '.docsearch/**'
- 'README.md'
- '.gitpod.yml'
workflow_dispatch:
env:
NO_INDEX: true
ALGOLIA_APP_ID: ${{secrets.ALGOLIA_APP_ID}}
ALGOLIA_KEY: ${{secrets.ALGOLIA_KEY}}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16.x
- 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
- uses: actions/cache@v2
id: cache-build
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}
- name: Run Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
npm run build
deploy-staging:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- run: pip install crcmod
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v0'
with:
version: '290.0.1'
project_id: ${{ secrets.RUN_PROJECT }}
service_account_key: ${{ secrets.RUN_SA_KEY }}
- 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 }}
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
env:
NO_INDEX: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- run: pip install crcmod
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v0'
with:
version: '290.0.1'
project_id: ${{ secrets.RUN_PROJECT_PROD }}
service_account_key: ${{ secrets.RUN_SA_KEY_PROD }}
# - uses: actions/cache@v2
# id: cache-build
# with:
# path: |
# build
# key: ${{ runner.os }}-${{ github.sha }}
- 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 }}