Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): always build docs #4062

Merged
merged 6 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Installs the workspace's yarn dependencies and caches them
runs:
using: composite
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
id: node
with:
node-version: 18.17.1
Expand Down
50 changes: 33 additions & 17 deletions .github/workflows/docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- name: Check if label is present
id: check-labels
uses: actions/github-script@v3
uses: actions/github-script@v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -21,10 +21,11 @@ jobs:
}

// Fetch the list of files changed in the PR
const { data: files } = await github.pulls.listFiles({
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
pull_number: context.issue.number,
per_page: 100
});

// Check if any file is within the 'docs' folder
Expand All @@ -33,7 +34,7 @@ jobs:

- name: Add label if not present
if: steps.check-labels.outputs.result == 'true'
uses: actions/github-script@v3
uses: actions/github-script@v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -47,20 +48,14 @@ jobs:
})
}

build_and_deploy_preview:
build_preview:
runs-on: ubuntu-latest
permissions:
pull-requests: write
needs: add_label
if: needs.add_label.outputs.has_label == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-bindgen-cli
uses: taiki-e/install-action@v2
Expand All @@ -71,13 +66,34 @@ jobs:
run: |
npm i wasm-opt -g

- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Build docs
run:
yarn workspaces foreach -Rt run build
yarn workspaces foreach -Rpt --from docs run build

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: docs
path: ./docs/build/
retention-days: 3


deploy_preview:
needs: [build_preview, add_label]
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: needs.add_label.outputs.has_label == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download built docs
uses: actions/download-artifact@v3
with:
name: docs
path: ./docs/build

- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v2.1
with:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ jobs:
- name: Checkout release branch
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-bindgen-cli
uses: taiki-e/install-action@v2
Expand All @@ -29,9 +27,6 @@ jobs:
run: |
npm i wasm-opt -g

- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Build docs for deploying
working-directory: docs
run:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ jobs:
ref: ${{ fromJSON(needs.release-please.outputs.release-pr).headBranchName }}
token: ${{ secrets.NOIR_RELEASES_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install Yarn dependencies
uses: ./.github/actions/setup

Expand Down