Skip to content

Commit

Permalink
fix: Fix deploy pipeline (#2905)
Browse files Browse the repository at this point in the history
* fix: Fix deploy pipeline

* Running deploy to prod workflow only when it pushes to main

* Naming steps to understand better when checking the flow in the UI

* Building for every PR, including workflow changes

---------

Co-authored-by: Diego Molina <[email protected]>
  • Loading branch information
tianfeng92 and diemol authored Aug 27, 2024
1 parent 555e2da commit 237cf2f
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 38 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/deploy-pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- synchronize
- closed
paths-ignore:
- '.github/**'
- '.docsearch/**'
- 'README.md'
- '.gitpod.yml'
Expand All @@ -27,26 +26,32 @@ jobs:
deploy-pr-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x
- uses: actions/cache@v2
id: cache-build
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}

- uses: actions/cache@v2
- 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"

Expand Down
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
62 changes: 38 additions & 24 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 @@ -21,14 +20,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x

- uses: actions/cache@v2
- uses: actions/cache@v4
name: Cache NPM Packages
id: cache-npm-packages
with:
path: |
Expand All @@ -40,7 +42,8 @@ jobs:
run: |
npm install
- uses: actions/cache@v2
- uses: actions/cache@v4
name: Cache Build
id: cache-build
with:
path: |
Expand All @@ -58,38 +61,43 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x
- name: Install Python
uses: actions/setup-python@v2
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 }}
service_account_key: ${{ secrets.RUN_SA_KEY }}

- uses: actions/cache@v2
id: cache-build
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}

- uses: actions/cache@v2
- 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-npm-packages.outputs.cache-hit != 'true'
run: |
Expand All @@ -113,37 +121,43 @@ jobs:
NO_INDEX: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout Repository
with:
fetch-depth: 0
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 18.x
- name: Install Python
uses: actions/setup-python@v2
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@v2
id: cache-build
with:
path: |
build
key: ${{ runner.os }}-${{ github.sha }}

- uses: actions/cache@v2
- 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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vale-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 237cf2f

Please sign in to comment.