-
Notifications
You must be signed in to change notification settings - Fork 6
89 lines (76 loc) · 2.36 KB
/
Copy pathdeploy-to-branch.yml
File metadata and controls
89 lines (76 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: GitHub Pages (Branch Invoked)
# To see the workflow clearer, I try to deploy first to a branch and then publish it.
on:
push:
branches:
- main # Set a branch to deploy
pull_request:
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
deployments: write
concurrency:
group: "pages-${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v13
with:
use-flakehub: false
diagnostic-endpoint: ""
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(nix develop --command pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v5
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: nix develop --command pnpm install --frozen-lockfile
- name: Build page
run: nix develop --command pnpm docs:build
- name: Upload Build Artifact
uses: actions/upload-artifact@v7
with:
name: site-preview
path: content/.vitepress/dist
retention-days: 1
deploy:
needs: build
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: github-pages
url: https://oneamongus.ca
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v8
with:
name: site-preview
path: content/.vitepress/dist
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./content/.vitepress/dist
publish_branch: deploy
cname: oneamongus.ca
destination_dir: ./.