nixos-and-flakes-book/.github/workflows/deploy.yml

61 lines
1.7 KiB
YAML
Raw Normal View History

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
2023-06-23 08:41:46 +00:00
# setup nodejs, pnpm and vitepress
- uses: actions/setup-node@v3
with:
node-version: 18
2023-06-23 08:41:46 +00:00
- 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
2023-06-23 08:43:37 +00:00
run: pnpm docs:build
- uses: actions/configure-pages@v2
- uses: actions/upload-pages-artifact@v1
with:
path: docs/.vitepress/dist
# use vercel currently, so disable this one
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action