-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (159 loc) · 4.89 KB
/
deploy.yml
File metadata and controls
167 lines (159 loc) · 4.89 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Deploy explainer
on:
push:
branches: [main]
workflow_dispatch:
inputs:
docs:
description: 'Deploy Docs'
type: boolean
default: true
blog:
description: 'Deploy Blog'
type: boolean
default: true
website:
description: 'Deploy Website'
type: boolean
default: true
jobs:
changes:
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
blog: ${{ steps.filter.outputs.blog }}
website: ${{ steps.filter.outputs.website }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
docs:
- 'apps/docs/**'
- 'packages/**'
- 'pnpm-lock.yaml'
blog:
- 'apps/blog/**'
- 'packages/**'
- 'pnpm-lock.yaml'
website:
- 'apps/website/**'
- 'packages/**'
- 'pnpm-lock.yaml'
build-docs:
needs: changes
if: needs.changes.outputs.docs == 'true' || (github.event_name == 'workflow_dispatch' && inputs.docs)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm --filter @explainer/docs build
env:
PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }}
PUBLIC_BLOG_URL: ${{ vars.PUBLIC_BLOG_URL }}
PUBLIC_WEBSITE_URL: ${{ vars.PUBLIC_WEBSITE_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v5
with:
name: docs-dist
path: apps/docs/dist/
build-blog:
needs: changes
if: needs.changes.outputs.blog == 'true' || (github.event_name == 'workflow_dispatch' && inputs.blog) || github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm --filter @explainer/blog build
env:
PUBLIC_BLOG_URL: ${{ vars.PUBLIC_BLOG_URL }}
PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }}
PUBLIC_WEBSITE_URL: ${{ vars.PUBLIC_WEBSITE_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v5
with:
name: blog-dist
path: apps/blog/dist/
build-website:
needs: changes
if: needs.changes.outputs.website == 'true' || (github.event_name == 'workflow_dispatch' && inputs.website)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm --filter @explainer/website build
env:
PUBLIC_WEBSITE_URL: ${{ vars.PUBLIC_WEBSITE_URL }}
PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }}
PUBLIC_BLOG_URL: ${{ vars.PUBLIC_BLOG_URL }}
- uses: actions/upload-artifact@v5
with:
name: website-dist
path: apps/website/dist/
deploy-docs:
needs: build-docs
if: vars.DEPLOY_TARGET == 'cloudflare'
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/download-artifact@v5
with:
name: docs-dist
path: dist
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=explainer-docs
deploy-blog:
needs: build-blog
if: vars.DEPLOY_TARGET == 'cloudflare'
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/download-artifact@v5
with:
name: blog-dist
path: dist
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=explainer-blog
deploy-website:
needs: build-website
if: vars.DEPLOY_TARGET == 'cloudflare'
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/download-artifact@v5
with:
name: website-dist
path: dist
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name=explainer-website