move into a .github dir #1
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: "Build GitHub Pages" | |
on: push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
Build-GitHub-Pages: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install apt dependencies | |
run: | | |
sudo ./install-apt-deps.sh | |
- uses: actions/setup-node@v4 | |
with: | |
# Be sure to keep this in sync with .tugboat/config.yml. | |
node-version: 18 | |
- name: Get npm cache directory path | |
id: npm-cache-dir-path | |
run: echo "::set-output name=dir::$(npm config get cache)" | |
- uses: actions/cache@v4 | |
id: npm-cache | |
with: | |
path: ${{ steps.npm-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Build Website | |
run: | | |
npm run build | |
- name: Archive build results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: _site | |
path: _site | |
Publish-GitHub-Pages: | |
runs-on: ubuntu-20.04 | |
needs: [Build-GitHub-Pages] | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: _site | |
path: _site | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: _site | |
exclude_assets: '.github,build.sh,CONTRIBUTING.md,install-calibre.sh,Dockerfile,package.json,yarn.lock,renovate.json,.tugboat,.gitignore' |