-
Notifications
You must be signed in to change notification settings - Fork 5
64 lines (55 loc) · 1.83 KB
/
Copy pathdeploy.yml
File metadata and controls
64 lines (55 loc) · 1.83 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
on:
push:
branches:
- main
- dev
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
environment:
name: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
url: ${{ github.ref == 'refs/heads/main' && 'https://pengu.lol' || 'https://pengu.dev' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Resolve Pages project
env:
PROJECT: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
run: |
if [[ -z "$PROJECT" ]]; then
echo "::error::CLOUDFLARE_PROJECT_NAME secret is not set."
exit 1
fi
echo "CF_PAGES_PROJECT=$PROJECT" >> $GITHUB_ENV
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: pnpm
- name: Build project
run: |
pnpm install
pnpm build
# Single Pages project, two domains routed by branch:
# main -> production deployment -> pengu.lol
# dev -> dev.<project>.pages.dev alias -> pengu.dev
# --branch is what picks between them, so it must always be passed.
# pengu.dev reaches the dev build via a proxied CNAME retargeted at the
# branch alias -- see docs/guide or the Cloudflare dashboard DNS tab.
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: >-
pages deploy .vitepress/dist
--project-name=${{ env.CF_PAGES_PROJECT }}
--branch=${{ github.ref_name }}