nixos-and-flakes-book/.github/workflows/deploy.yml
2023-06-23 21:22:07 +08:00

60 lines
1.8 KiB
YAML

name: Deploy
on:
workflow_dispatch: {}
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
# permissions:
# pages: write # to deploy to Pages
# id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# setup nodejs, pnpm and vitepress
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
# build and deploy the docs
- name: Build
run: pnpm docs:build
# use vercel currently, so disable this one
# - uses: actions/configure-pages@v2
# - uses: actions/upload-pages-artifact@v1
# with:
# path: docs/.vitepress/dist
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action