Skip to content

Commit

Permalink
ci: update pipelines (#2907)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexplischke authored Aug 27, 2024
1 parent 1ec29bb commit 15fc1b0
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 168 deletions.
47 changes: 14 additions & 33 deletions .github/workflows/deploy-pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- opened
- reopened
- synchronize
- closed
- closed
paths-ignore:
- '.docsearch/**'
- 'README.md'
Expand All @@ -26,48 +26,29 @@ jobs:
deploy-pr-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x

- uses: actions/cache@v4
if: github.event.action != 'closed' # Skip if the PR was closed
name: Cache NPM Packages
id: cache-npm-packages
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
- name: Checkout
uses: actions/checkout@v4

- uses: actions/cache@v4
if: github.event.action != 'closed' # Skip if the PR was closed
name: Cache Build
id: cache-build
- name: Setup Node.js
uses: actions/setup-node@v4
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}

node-version-file: '.nvmrc'
cache: 'npm'

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

- name: Install Dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true' && github.event.action != 'closed' # Skip if the PR was closed
if: github.event.action != 'closed' # Skip if the PR was closed
run: |
npm install
- name: Run Build
if: steps.cache-build.outputs.cache-hit != 'true' && github.event.action != 'closed' # Skip if the PR was closed
- name: Build
if: github.event.action != 'closed' # Skip if the PR was closed
run: |
npm run build
- name: Deploy PR preview
- name: Deploy PR
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build/
source-dir: ./build/
158 changes: 46 additions & 112 deletions .github/workflows/deploy-to-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,163 +12,97 @@ on:
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@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x

- uses: actions/cache@v4
name: Cache NPM Packages
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@v4
name: Cache Build
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:
needs: build
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
env:
NO_INDEX: true

steps:
- uses: actions/checkout@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x
- name: Install Python
uses: actions/setup-python@v2
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
python-version: 3.7
- run: pip install crcmod
name: Install crcmod
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v0'
node-version-file: '.nvmrc'
cache: 'npm'

- name: Setup Python
uses: actions/setup-python@v5
with:
version: '290.0.1'
project_id: ${{ secrets.RUN_PROJECT }}
service_account_key: ${{ secrets.RUN_SA_KEY }}
python-version: '3.12'

- uses: actions/cache@v4
name: Cache NPM Packages
id: cache-npm-packages
- name: Google Cloud Login
uses: google-github-actions/auth@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
credentials_json: '${{ secrets.RUN_SA_KEY }}'

- uses: actions/cache@v4
name: Cache Build
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@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x
- name: Install Python
uses: actions/setup-python@v2
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
python-version: 3.7
- run: pip install crcmod
name: Install crcmod
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v0'
node-version-file: '.nvmrc'
cache: 'npm'

- name: Setup Python
uses: actions/setup-python@v5
with:
version: '290.0.1'
project_id: ${{ secrets.RUN_PROJECT_PROD }}
service_account_key: ${{ secrets.RUN_SA_KEY_PROD }}
python-version: '3.12'

- uses: actions/cache@v4
name: Cache NPM Packages
id: cache-npm-packages
- name: Google Cloud Login
uses: google-github-actions/auth@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
credentials_json: '${{ secrets.RUN_SA_KEY_PROD }}'

- uses: actions/cache@v4
name: Cache Build
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_PROD }}
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 }}
50 changes: 29 additions & 21 deletions .github/workflows/link-checker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sauce Docs Link Checker
name: Link Checker

on:
pull_request:
Expand All @@ -13,35 +13,43 @@ env:
SLACK_LINK: ${{secrets.SLACK_LINK}}
GITLAB_TOKEN: ${{secrets.GITLAB_TOKEN}}

defaults:
run:
working-directory: tests/sauce-docs-checker

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build and Run Docusaurus Site
working-directory: ./
python-version: '3.12'

- name: Install Dependencies
run: |
npm install && npm run build
# Expose website
cd build/ && python3 -m http.server 8000 &
npm install
- name: Build
run: |
npm run build
- name: Serve Docs
working-directory: build
run: |
python3 -m http.server 8000 &
- name: Install Test Dependencies
working-directory: tests/sauce-docs-checker
run: |
npm install
- name: Set GitHub Action Job URL
run: |
echo $GITHUB_RUN_ID
- name: Start Link Checker Script
- name: Check Links
working-directory: tests/sauce-docs-checker
run: |
npm start -- $GITHUB_RUN_ID
7 changes: 5 additions & 2 deletions .github/workflows/vale-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ jobs:
name: runner / vale
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: errata-ai/vale-action@reviewdog
- name: Checkout
uses: actions/checkout@v4

- name: Lint
uses: errata-ai/vale-action@reviewdog
with:
reporter: github-pr-review
level: error
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18

0 comments on commit 15fc1b0

Please sign in to comment.