diff --git a/.github/workflows/deploy-pr-preview.yml b/.github/workflows/deploy-pr-preview.yml index bc2c5fe331..55601a8653 100644 --- a/.github/workflows/deploy-pr-preview.yml +++ b/.github/workflows/deploy-pr-preview.yml @@ -8,7 +8,7 @@ on: - opened - reopened - synchronize - - closed + - closed paths-ignore: - '.docsearch/**' - 'README.md' @@ -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/ \ No newline at end of file + source-dir: ./build/ diff --git a/.github/workflows/deploy-to-production.yml b/.github/workflows/deploy-to-production.yml index 6103523c63..6b36b60c38 100644 --- a/.github/workflows/deploy-to-production.yml +++ b/.github/workflows/deploy-to-production.yml @@ -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 }} diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml index 8537d178df..ea56f096eb 100644 --- a/.github/workflows/link-checker.yml +++ b/.github/workflows/link-checker.yml @@ -1,4 +1,4 @@ -name: Sauce Docs Link Checker +name: Link Checker on: pull_request: @@ -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 diff --git a/.github/workflows/vale-linter.yml b/.github/workflows/vale-linter.yml index 911ae46872..e61426ad3c 100644 --- a/.github/workflows/vale-linter.yml +++ b/.github/workflows/vale-linter.yml @@ -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 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..3f430af82b --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18