-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: improve pipeline for documentation
- Add cache and restore `node_modules` step - Add path filtering - Add `fetch-depth` and `fetch-tags` for checkout step - Rename file to be snake_case
- Loading branch information
Showing
2 changed files
with
89 additions
and
52 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Documentation CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- '**' | ||
paths: | ||
- 'website/**' | ||
- '.github/**' | ||
- '.yarn/**' | ||
- .yarnrc.yml | ||
- .npmignore | ||
- .gitignore | ||
|
||
concurrency: | ||
group: doc-generator-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
checks: | ||
if: github.event_name != 'push' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 # If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly. | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 20 | ||
fetch-tags: false | ||
|
||
- name: Restore cached node modules ♻️ | ||
id: cache-yarn | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
website/node_modules | ||
website/.yarn | ||
key: ${{ runner.os }}-build-doc-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: ${{ runner.os }}-build-doc | ||
|
||
- name: Install 🔧 | ||
if: ${{ steps.cache-yarn.outputs.cache-hit != 'true' }} | ||
run: yarn | ||
working-directory: website | ||
|
||
- name: Build 🔨 | ||
run: yarn build | ||
working-directory: website | ||
|
||
build-and-deploy: | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v4 # If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly. | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 20 | ||
fetch-tags: false | ||
|
||
- name: Restore cached node modules ♻️ | ||
id: cache-yarn | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
website/node_modules | ||
website/.yarn | ||
key: ${{ runner.os }}-build-doc-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: ${{ runner.os }}-build-doc | ||
|
||
- name: Install 🔧 | ||
if: ${{ steps.cache-yarn.outputs.cache-hit != 'true' }} | ||
run: yarn | ||
working-directory: website | ||
|
||
- name: Build 🔨 | ||
run: yarn build | ||
working-directory: website | ||
|
||
- name: Deploy 🚀 | ||
uses: JamesIves/github-pages-deploy-action@v4.6.0 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages # The branch the action should deploy to. | ||
FOLDER: website/build # The folder the action should deploy. | ||
CLEAN: true # Automatically remove deleted files from the deploy branch |