This repository has been archived by the owner on Jul 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 2.04 KB
/
publish.yml
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
name: "Publish"
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
# 手動実行か否か
IS_DISPATCH: ${{ contains(fromJSON('["workflow_dispatch"]'), github.event_name) }}
jobs:
changed:
runs-on: ubuntu-22.04
outputs:
docs: ${{ steps.needs.outputs.docs }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Paths Changes Filter
uses: dorny/[email protected]
id: changes
with:
filters: |
docs:
- 'apps/docs/**/*'
- 'package.json'
- name: Output Needs
id: needs
run: |
echo "docs=${{ env.IS_DISPATCH == 'true' || steps.changes.outputs.docs == 'true' }}" >> $GITHUB_OUTPUT
publish-docs:
runs-on: ubuntu-22.04
needs: changed
if: needs.changed.outputs.docs == 'true'
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/[email protected]
- name: Create GitHub App Token
uses: actions/[email protected]
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: 'package.json'
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Clean install using pnpm
shell: bash
run: pnpm install --filter=docs --frozen-lockfile
- name: Build
run: pnpm run build --filter=docs
- name: Publish to Cloudflare Pages
uses: cloudflare/[email protected]
id: cloudflare-pages
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
projectName: web-application-template-docs
directory: ./apps/docs/dist
gitHubToken: ${{ steps.app-token.outputs.token }}
branch: main