Skip to content

Commit

Permalink
Merge branch 'main' into job-overview-page-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-saucelabs authored Sep 4, 2024
2 parents 66d93e8 + 93a0f43 commit 7bb8be4
Show file tree
Hide file tree
Showing 93 changed files with 5,155 additions and 12,272 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

31 changes: 0 additions & 31 deletions .eslintrc.json

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/deploy-pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Deploy PR Preview

on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- closed
paths-ignore:
- '.docsearch/**'
- 'README.md'
- '.gitpod.yml'
workflow_dispatch:

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

concurrency: preview-${{ github.ref }}

jobs:
deploy-pr-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Google Cloud Login
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.RUN_SA_KEY_DEV }}'

- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.RUN_PROJECT_DEV }}
env:
CLOUDSDK_PYTHON: ${{ env.pythonLocation }}/python

- name: Set Preview Path
run: echo "PREVIEW_PATH=pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV"

- name: Install Dependencies
if: github.event.action != 'closed' # Skip if the PR was closed
run: |
npm install
- name: Build
if: github.event.action != 'closed' # Skip if the PR was closed
run: |
npm run build
- name: Deploy
if: github.event.action != 'closed' # Skip if the PR was closed
working-directory: build
run: |-
gsutil -m rsync -R -d . ${{ secrets.GCS_DEV_BUCKET }}/${{ env.PREVIEW_PATH }}
- name: Deploy Message
if: github.event.action != 'closed' # Skip if the PR was closed
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: |
Deploy preview ready for ${{ github.event.number }}!
https://docs.dev.saucelabs.net/${{ env.PREVIEW_PATH }}
- name: Cleanup
if: github.event.action == 'closed' # Cleanup action only on PR closure
run: |-
gsutil rm -r ${{ secrets.GCS_DEV_BUCKET }}/${{ env.PREVIEW_PATH }}
6 changes: 3 additions & 3 deletions .github/workflows/deploy-to-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
deploy-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install Python
Expand All @@ -38,7 +38,7 @@ jobs:
project_id: ${{ secrets.RUN_PROJECT_DEV }}
service_account_key: ${{ secrets.RUN_SA_KEY_DEV }}

- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache-build
with:
path: |
Expand Down
136 changes: 53 additions & 83 deletions .github/workflows/deploy-to-production.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Deploy to Production

on:
pull_request:
push:
branches:
- main
Expand All @@ -13,133 +12,104 @@ on:
workflow_dispatch:

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

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}

jobs:
build:
deploy-staging:
runs-on: ubuntu-latest
env:
NO_INDEX: true

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18.x
fetch-depth: 0 # For correct author and date information on pages.

- uses: actions/cache@v2
id: cache-npm-packages
- name: Setup Node.js
uses: actions/setup-node@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: |
npm install
- uses: actions/cache@v2
id: cache-build
- name: Setup Python
uses: actions/setup-python@v5
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' }}
python-version: '3.12'

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
- name: Google Cloud Login
uses: google-github-actions/auth@v2
with:
node-version: 18.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 }}
credentials_json: '${{ secrets.RUN_SA_KEY }}'

- uses: actions/cache@v2
id: cache-build
- name: Setup Google Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}
project_id: ${{ secrets.RUN_PROJECT }}
env:
CLOUDSDK_PYTHON: ${{ env.pythonLocation }}/python

- 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'
- name: Build
run: |
npm run build
- name: Deploy to Bucket
- name: Deploy
working-directory: build
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
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # For correct author and date information on pages.

- name: Setup Node.js
uses: actions/setup-node@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v1
node-version-file: '.nvmrc'
cache: 'npm'

- name: Setup Python
uses: actions/setup-python@v5
with:
node-version: 18.x
- name: Install Python
uses: actions/setup-python@v2
python-version: '3.12'

- name: Google Cloud Login
uses: google-github-actions/auth@v2
with:
python-version: 3.7
- run: pip install crcmod
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v0'
credentials_json: '${{ secrets.RUN_SA_KEY_PROD }}'

- name: Setup Google Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'
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 }}
env:
CLOUDSDK_PYTHON: ${{ env.pythonLocation }}/python

- 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'
- name: Build
run: |
npm run build
- name: Deploy to Bucket
- name: Deploy
working-directory: build
run: |-
cd build
gsutil -m rsync -R -d . ${{ secrets.GCS_PROD_BUCKET }}
Loading

0 comments on commit 7bb8be4

Please sign in to comment.