From dbfaebe2b964fba1531adb06362b136090edbe44 Mon Sep 17 00:00:00 2001 From: Tian Feng Date: Mon, 26 Aug 2024 16:19:24 -0700 Subject: [PATCH 1/4] fix: Fix deploy pipeline --- .github/workflows/deploy-pr-preview.yml | 8 ++++---- .github/workflows/deploy-to-dev.yml | 6 +++--- .github/workflows/deploy-to-production.yml | 24 +++++++++++----------- .github/workflows/vale-linter.yml | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy-pr-preview.yml b/.github/workflows/deploy-pr-preview.yml index cd716123ad..f29101165e 100644 --- a/.github/workflows/deploy-pr-preview.yml +++ b/.github/workflows/deploy-pr-preview.yml @@ -27,20 +27,20 @@ jobs: deploy-pr-preview: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: node-version: 18.x - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-build with: path: | build key: ${{ runner.os }}-${{ github.sha }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-npm-packages with: path: | diff --git a/.github/workflows/deploy-to-dev.yml b/.github/workflows/deploy-to-dev.yml index 73c6b6e2e8..6719d8027e 100644 --- a/.github/workflows/deploy-to-dev.yml +++ b/.github/workflows/deploy-to-dev.yml @@ -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 @@ -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: | diff --git a/.github/workflows/deploy-to-production.yml b/.github/workflows/deploy-to-production.yml index d246092592..32105f4419 100644 --- a/.github/workflows/deploy-to-production.yml +++ b/.github/workflows/deploy-to-production.yml @@ -21,14 +21,14 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18.x - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-npm-packages with: path: | @@ -40,7 +40,7 @@ jobs: run: | npm install - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-build with: path: | @@ -58,10 +58,10 @@ jobs: if: ${{ github.ref == 'refs/heads/main' }} 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 @@ -76,14 +76,14 @@ jobs: project_id: ${{ secrets.RUN_PROJECT }} service_account_key: ${{ secrets.RUN_SA_KEY }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-build with: path: | build key: ${{ runner.os }}-${{ github.sha }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-npm-packages with: path: | @@ -113,10 +113,10 @@ jobs: NO_INDEX: false 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 @@ -130,14 +130,14 @@ jobs: version: '290.0.1' project_id: ${{ secrets.RUN_PROJECT_PROD }} service_account_key: ${{ secrets.RUN_SA_KEY_PROD }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-build with: path: | build key: ${{ runner.os }}-${{ github.sha }} - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: cache-npm-packages with: path: | diff --git a/.github/workflows/vale-linter.yml b/.github/workflows/vale-linter.yml index 0c6dd2dd8c..911ae46872 100644 --- a/.github/workflows/vale-linter.yml +++ b/.github/workflows/vale-linter.yml @@ -6,7 +6,7 @@ jobs: name: runner / vale runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: errata-ai/vale-action@reviewdog with: reporter: github-pr-review From 5f03a85c9837a5b350c94b8e5e9eea4ccfd5951c Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Tue, 27 Aug 2024 11:59:01 +0200 Subject: [PATCH 2/4] Running deploy to prod workflow only when it pushes to main --- .github/workflows/deploy-to-production.yml | 40 +++++++++++++++------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy-to-production.yml b/.github/workflows/deploy-to-production.yml index 32105f4419..6103523c63 100644 --- a/.github/workflows/deploy-to-production.yml +++ b/.github/workflows/deploy-to-production.yml @@ -1,7 +1,6 @@ name: Deploy to Production on: - pull_request: push: branches: - main @@ -22,13 +21,16 @@ jobs: 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: | @@ -41,6 +43,7 @@ jobs: npm install - uses: actions/cache@v4 + name: Cache Build id: cache-build with: path: | @@ -59,9 +62,11 @@ jobs: 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 @@ -69,6 +74,7 @@ jobs: with: python-version: 3.7 - run: pip install crcmod + name: Install crcmod - name: Set up Cloud SDK uses: 'google-github-actions/setup-gcloud@v0' with: @@ -77,18 +83,20 @@ jobs: service_account_key: ${{ secrets.RUN_SA_KEY }} - uses: actions/cache@v4 - id: cache-build + name: Cache NPM Packages + id: cache-npm-packages with: path: | - build - key: ${{ runner.os }}-${{ github.sha }} + **/node_modules + key: ${{ runner.os }}-${{ hashFiles('**/package.json') }} - uses: actions/cache@v4 - id: cache-npm-packages + name: Cache Build + id: cache-build with: path: | - **/node_modules - key: ${{ runner.os }}-${{ hashFiles('**/package.json') }} + build + key: ${{ runner.os }}-${{ github.sha }} - name: Install Dependencies if: steps.cache-npm-packages.outputs.cache-hit != 'true' @@ -114,9 +122,11 @@ jobs: 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 @@ -124,26 +134,30 @@ jobs: with: python-version: 3.7 - run: pip install crcmod + name: 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@v4 - id: cache-build - with: - path: | - build - key: ${{ runner.os }}-${{ github.sha }} - uses: actions/cache@v4 + name: Cache NPM Packages id: cache-npm-packages with: path: | **/node_modules key: ${{ runner.os }}-${{ hashFiles('**/package.json') }} + - uses: actions/cache@v4 + name: Cache Build + id: cache-build + with: + path: | + build + key: ${{ runner.os }}-${{ github.sha }} + - name: Install Dependencies if: steps.cache-build.outputs.cache-hit != 'true' run: | From 27c23bf78f24c5f9d281523e856c273080b148c8 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Tue, 27 Aug 2024 12:01:41 +0200 Subject: [PATCH 3/4] Naming steps to understand better when checking the flow in the UI --- .github/workflows/deploy-pr-preview.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-pr-preview.yml b/.github/workflows/deploy-pr-preview.yml index f29101165e..93966078da 100644 --- a/.github/workflows/deploy-pr-preview.yml +++ b/.github/workflows/deploy-pr-preview.yml @@ -28,25 +28,31 @@ jobs: 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 - id: cache-build - with: - path: | - build - key: ${{ runner.os }}-${{ github.sha }} - uses: actions/cache@v4 + name: Cache NPM Packages id: cache-npm-packages with: path: | **/node_modules key: ${{ runner.os }}-${{ hashFiles('**/package.json') }} + - uses: actions/cache@v4 + name: Cache Build + id: cache-build + with: + path: | + build + key: ${{ runner.os }}-${{ github.sha }} + + - name: Set preview path run: echo "PREVIEW_PATH=sauce-docs/pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV" From 0535d0509e8b0ec00f75242ed3256b6170bf59d0 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Tue, 27 Aug 2024 12:13:03 +0200 Subject: [PATCH 4/4] Building for every PR, including workflow changes --- .github/workflows/deploy-pr-preview.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-pr-preview.yml b/.github/workflows/deploy-pr-preview.yml index 93966078da..e3d41eef8f 100644 --- a/.github/workflows/deploy-pr-preview.yml +++ b/.github/workflows/deploy-pr-preview.yml @@ -10,7 +10,6 @@ on: - synchronize - closed paths-ignore: - - '.github/**' - '.docsearch/**' - 'README.md' - '.gitpod.yml'