ci: update Checkout GitHub Action to v4 (#17) #39
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
name: "NgRx Essentials website" | |
env: | |
NODE_OPTIONS: --max_old_space_size=6144 | |
node-version: 14.x | |
website-package-name: website | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
jobs: | |
build: | |
name: Build website | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ env.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node-version }} | |
- name: Variable-Yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache Yarn cache directory | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ env.node-version }}-yarn-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ env.node-version }} | |
${{ runner.os }} | |
- run: yarn install | |
- name: Build website | |
run: yarn build | |
- name: "Upload website build artifact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.website-package-name }} | |
path: ./build/ | |
if-no-files-found: error | |
deploy: | |
name: Deploy website to GitHub Pages | |
if: > | |
github.ref == 'refs/heads/main' && (github.event_name == | |
'workflow_dispatch' || github.event_name == 'push') | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
package-path: ./static-website/ | |
steps: | |
# necessary for JamesIves/github-pages-deploy-action | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.website-package-name }} | |
path: ${{ env.package-path }} | |
- name: Deploy docs to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@releases/v4 | |
with: | |
branch: gh-pages | |
folder: ${{ env.package-path }} |