-
-
Notifications
You must be signed in to change notification settings - Fork 111
64 lines (59 loc) · 2.39 KB
/
deploy-pr.yaml
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
name: "Deploy to Cloudflare Pages (Preview)"
on: [pull_request_target]
jobs:
deploy:
runs-on: "ubuntu-latest"
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- name: "add comment"
if: github.event_name != 'push'
uses: mshick/add-pr-comment@v2
with:
message-id: "cloudflare-pages-preview"
message: |
## Deploying with [<img alt="Cloudflare Pages" width="16" src="https://user-images.githubusercontent.com/23264/106598434-9e719e00-654f-11eb-9e59-6167043cfa01.png">](https://pages.dev) Cloudflare Pages
| Latest commit: | ${{ github.sha }} |
|---------------------------------|------------------------|
| Status: | 🔨 Building... |
---
- name: "checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 0
- name: "setup pnpm"
uses: "pnpm/action-setup@v4"
- name: "setup node"
uses: "actions/setup-node@v4"
with:
cache: "pnpm"
node-version: 20
- name: "install dependencies"
run: "pnpm install"
- name: "build"
run: "pnpm run build"
- name: "copy cloudflare configuration files to build directory"
run: |
cp _headers build/
cp _redirects build/
- name: "publish (push)"
id: "cloudflare-publish"
uses: "cloudflare/pages-action@v1"
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: "papermc-docs"
directory: "build"
- name: "add comment"
uses: "mshick/add-pr-comment@v2"
with:
message-id: "cloudflare-pages-preview"
message: |
## Deploying with [<img alt="Cloudflare Pages" width="16" src="https://user-images.githubusercontent.com/23264/106598434-9e719e00-654f-11eb-9e59-6167043cfa01.png">](https://pages.dev) Cloudflare Pages
| Latest commit: | ${{ github.sha }} |
|---------------------------------|------------------------|
| Status: | ✅ Deploy successful! |
| Preview URL: | [${{ steps.cloudflare-publish.outputs.url }}](${{ steps.cloudflare-publish.outputs.url }}) |
[View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})