-
Notifications
You must be signed in to change notification settings - Fork 25
240 lines (233 loc) · 8.68 KB
/
publish-site.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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: site-publish
# Publishes Github Site Pages for twitter/util, twitter/scrooge, twitter/finagle,
# twitter/twitter-server, and twitter/finatra
#
# Expects a repository dispatch event: https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
# in the form of JSON data POST to /repos/twitter/dodo/dispatches:
#
# {
# "event_type": "publish-site",
# "client_payload": {
# "dry_run": true
# }
# }
env:
JAVA_OPTS: "-Dsbt.log.noformat=true"
API_USER: ${{ secrets.API_USER }}
API_KEY: ${{ secrets.API_KEY }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SCALA_VERSION: "2.13"
REMOTE_BASE: "https://${API_USER}:${API_KEY}@github.com/twitter"
defaults:
run:
shell: bash --noprofile --norc -eux -o pipefail {0}
on:
repository_dispatch:
types: [publish-site]
jobs:
publish-site:
runs-on: ubuntu-latest
steps:
- name: dump/context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/[email protected]
- uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: olafurpg/setup-scala@v10
with:
java-version: [email protected]
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: setup/sphinx
run: |
sudo apt-get update
sudo apt-get install python3-sphinx
- name: setup/git
run: |
git config --global user.email "${API_USER}@twitter.com"
git config --global user.name "$API_USER"
# publish util site
- name: checkout/util
uses: actions/[email protected]
with:
repository: twitter/util
token: ${{ secrets.API_KEY }}
ref: release
path: util
- name: generate/util
run: |
./sbt --warn util-doc/makeSite
./sbt --warn unidoc
working-directory: ${{ github.workspace }}/util
- name: checkout/util-gh-pages
uses: actions/[email protected]
with:
repository: twitter/util
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: util-gh-pages
- name: publish/util-gh-pages
run: |
touch .nojekyll
cp ${{ github.workspace }}/util/site/index.html .
rm -fr docs/
cp -r ${{ github.workspace }}/util/target/scala-$SCALA_VERSION/unidoc/ docs/
rm -fr guide/
cp -r ${{ github.workspace }}/util/doc/target/site/ guide/
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/util-gh-pages
- name: push/util-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/util.git HEAD
working-directory: ${{ github.workspace }}/util-gh-pages
# publish scrooge site
- name: checkout/scrooge
uses: actions/[email protected]
with:
repository: twitter/scrooge
token: ${{ secrets.API_KEY }}
ref: release
path: scrooge
- name: generate/scrooge
run: |
./sbt --warn scrooge-doc/makeSite
working-directory: ${{ github.workspace }}/scrooge
- name: checkout/scrooge-gh-pages
uses: actions/[email protected]
with:
repository: twitter/scrooge
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: scrooge-gh-pages
- name: publish/scrooge-gh-pages
run: |
git rm -fr --ignore-unmatch .
touch .nojekyll
cp -r ${{ github.workspace }}/scrooge/doc/target/site/* .
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/scrooge-gh-pages
- name: push/scrooge-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/scrooge.git HEAD
working-directory: ${{ github.workspace }}/scrooge-gh-pages
# publish finagle site
- name: checkout/finagle
uses: actions/[email protected]
with:
repository: twitter/finagle
token: ${{ secrets.API_KEY }}
ref: release
path: finagle
- name: generate/finagle
run: |
./sbt --warn finagle-doc/makeSite
./sbt --warn unidoc
working-directory: ${{ github.workspace }}/finagle
- name: checkout/finagle-gh-pages
uses: actions/[email protected]
with:
repository: twitter/finagle
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: finagle-gh-pages
- name: publish/finagle-gh-pages
run: |
touch .nojekyll
cp ${{ github.workspace }}/finagle/site/index.html .
rm -fr docs/
cp -r ${{ github.workspace }}/finagle/target/scala-$SCALA_VERSION/unidoc/ docs/
rm -fr guide/
cp -r ${{ github.workspace }}/finagle/doc/target/site/ guide/
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/finagle-gh-pages
- name: push/finagle-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/finagle.git HEAD
working-directory: ${{ github.workspace }}/finagle-gh-pages
# publish twitter-server site
- name: checkout/twitter-server
uses: actions/[email protected]
with:
repository: twitter/twitter-server
token: ${{ secrets.API_KEY }}
ref: release
path: twitter-server
- name: generate/twitter-server
run: |
./sbt --warn twitterServerDoc/makeSite
working-directory: ${{ github.workspace }}/twitter-server
- name: checkout/twitter-server-gh-pages
uses: actions/[email protected]
with:
repository: twitter/twitter-server
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: twitter-server-gh-pages
- name: publish/twitter-server-gh-pages
run: |
git rm -fr --ignore-unmatch .
touch .nojekyll
cp -r ${{ github.workspace }}/twitter-server/doc/target/site/* .
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/twitter-server-gh-pages
- name: push/twitter-server-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/twitter-server.git HEAD
working-directory: ${{ github.workspace }}/twitter-server-gh-pages
# publish finatra site
- name: checkout/finatra
uses: actions/[email protected]
with:
repository: twitter/finatra
token: ${{ secrets.API_KEY }}
ref: release
path: finatra
- name: generate/finatra
run: |
./sbt --warn site/makeSite
./sbt --warn unidoc
working-directory: ${{ github.workspace }}/finatra
- name: checkout/finatra-gh-pages
uses: actions/[email protected]
with:
repository: twitter/finatra
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: finatra-gh-pages
- name: publish/finatra-gh-pages
run: |
git rm -fr --ignore-unmatch .
touch .nojekyll
cp -r ${{ github.workspace }}/finatra/doc/target/site/* .
cp -r ${{ github.workspace }}/finatra/target/scala-$SCALA_VERSION/unidoc/ scaladocs/
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/finatra-gh-pages
- name: push/finatra-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/finatra.git HEAD
working-directory: ${{ github.workspace }}/finatra-gh-pages
- name: slack/notification-failure
if: ${{ cancelled() || failure() }}
run: ${{ github.workspace }}/bin/slack --verbose --denote-dry-run ${{ github.event.client_payload.dry_run }} --message "📓 ${{ github.event.client_payload.version }} Site publish \`failed\`." --color "#DA2700"
- name: slack/notification-success
if: ${{ success() }}
run: ${{ github.workspace }}/bin/slack --verbose --denote-dry-run ${{ github.event.client_payload.dry_run }} --message "📓 ${{ github.event.client_payload.version }} Site publish \`successful\`." --color "#229954"