-
-
Notifications
You must be signed in to change notification settings - Fork 14
308 lines (248 loc) · 9.92 KB
/
deploy.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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
name: Documentation
on:
push:
branches:
- main
workflow_dispatch:
repository_dispatch:
types:
- docs
permissions:
id-token: write
pages: write
env:
ALGOLIA_APP_NAME: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_ARTIFACT: algolia-indexes-LARAVEL-LANG.zip
ALGOLIA_INDEX_NAME: laravel-lang
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}
ARTIFACT_DOCS: webHelpLARAVEL-LANG2-all.zip
ARTIFACT_INDEXES: search-indexes
ARTIFACT_INDEXES_CLEARED: search-indexes-cleared
CONFIG_JSON_PRODUCT: LARAVEL-LANG
CONFIG_JSON_VERSION: main
INSTANCE: docs/laravel-lang
DOMAIN_NAME: laravel-lang.com
BUILDER_VERSION: 232.10275
jobs:
build:
name: Build application
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, simplexml
coverage: xdebug
- name: Configure git
run: git config --global --add safe.directory /github/workspace
- name: Install dependencies
run: composer update --no-progress --no-interaction
- name: Clone projects
run: |
rm -rf tmp/actions
rm -rf tmp/attributes
rm -rf tmp/http-statuses
rm -rf tmp/lang
git clone --no-tags --single-branch https://github.com/Laravel-Lang/actions.git tmp/actions
git clone --no-tags --single-branch https://github.com/Laravel-Lang/attributes.git tmp/attributes
git clone --no-tags --single-branch https://github.com/Laravel-Lang/http-statuses.git tmp/http-statuses
git clone --no-tags --single-branch https://github.com/Laravel-Lang/lang.git tmp/lang
- name: Move completion statuses
run: |
php src/statuses.php
php src/available.php
- name: Update examples
run: |
php src/native_names.php
- name: Build documentation
uses: JetBrains/writerside-github-action@v4
with:
instance: ${{ env.INSTANCE }}
artifact: ${{ env.ARTIFACT_DOCS }}
docker-version: ${{ env.BUILDER_VERSION }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: docs
path: |
artifacts/${{ env.ARTIFACT_DOCS }}
artifacts/report.json
retention-days: 7
- name: Upload search indexes
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_INDEXES }}
path: artifacts/${{ env.ALGOLIA_ARTIFACT }}
retention-days: 7
test:
needs: build
name: Testing
runs-on: ubuntu-latest
steps:
- name: Download docs artifact
uses: actions/download-artifact@v3
with:
name: docs
path: artifacts
- name: Test documentation
uses: JetBrains/writerside-checker-action@v1
with:
instance: ${{ env.INSTANCE }}
cleanup_algolia:
needs: build
name: Cleaning up search indexes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: montudor/action-zip@v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, simplexml
coverage: xdebug
- name: Configure git
run: git config --global --add safe.directory /github/workspace
- name: Install dependencies
run: composer update --no-progress --no-interaction
- name: Download search artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_INDEXES }}
- name: Unzip artifact
run: unzip -qq ${{ env.ALGOLIA_ARTIFACT }} -d ${{ env.ARTIFACT_INDEXES }}
- name: Clean up
run: sudo php src/clean_algolia.php ${{ env.ARTIFACT_INDEXES }}
- name: Zip artifact
run: |
rm -f ${{ env.ALGOLIA_ARTIFACT }}
cd ${{ env.ARTIFACT_INDEXES }}
zip -qq -r ${{ env.ALGOLIA_ARTIFACT }} *
cd ..
- name: Update search indexes
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_INDEXES_CLEARED }}
path: ${{ env.ARTIFACT_INDEXES }}/${{ env.ALGOLIA_ARTIFACT }}
retention-days: 7
sitemap:
needs: build
name: Generate sitemap
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, simplexml
coverage: xdebug
- name: Configure git
run: git config --global --add safe.directory /github/workspace
- name: Install dependencies
run: composer update --no-progress --no-interaction
- name: Download docs artifact
uses: actions/download-artifact@v3
with:
name: docs
- name: Unzip artifact
uses: montudor/action-zip@v1
with:
args: unzip -qq ${{ env.ARTIFACT_DOCS }} -d dir
- name: Generate sitemap
run: php src/sitemap.php
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: sitemap
path: sitemap.xml
retention-days: 7
robots:
needs: build
name: Generate robots.txt
runs-on: ubuntu-latest
steps:
- name: Create robots.txt
run: |
touch robots.txt
echo "User-Agent: *" >> robots.txt
echo "Disallow: " >> robots.txt
echo "Host: https://${{ env.DOMAIN_NAME }}" >> robots.txt
echo "Sitemap: https://${{ env.DOMAIN_NAME }}/sitemap.xml" >> robots.txt
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: robots
path: robots.txt
retention-days: 7
deploy-pages:
environment:
name: deploy
url: ${{ steps.deployment.outputs.page_url }}
needs:
- test
- sitemap
- robots
name: Deploy to pages
runs-on: ubuntu-latest
steps:
- name: Download docs artifact
uses: actions/download-artifact@v3
with:
name: docs
- name: Download sitemap artifact
uses: actions/download-artifact@v3
with:
name: sitemap
- name: Download robots artifact
uses: actions/download-artifact@v3
with:
name: robots
- name: Unzip artifact
uses: montudor/action-zip@v1
with:
args: unzip -qq ${{ env.ARTIFACT_DOCS }} -d dir
- name: Move sitemap and robots
run: |
sudo mv sitemap.xml dir/sitemap.xml
sudo mv robots.txt dir/robots.txt
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: dir
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
deploy-indexes:
environment: deploy
needs:
- test
- cleanup_algolia
name: Deploy to Algolia
runs-on: ubuntu-latest
timeout-minutes: 3
container:
image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-2
steps:
- name: Download search artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_INDEXES_CLEARED }}
- name: Unzip artifact
uses: montudor/action-zip@v1
with:
args: unzip -qq ${{ env.ALGOLIA_ARTIFACT }} -d ${{ env.ARTIFACT_INDEXES }}
- name: Deploy to Algolia
run: |
env "algolia-key=${{ env.ALGOLIA_KEY }}" java -jar /opt/builder/help-publication-agent.jar \
update-index \
--application-name ${{ env.ALGOLIA_APP_NAME }} \
--index-name ${{ env.ALGOLIA_INDEX_NAME }} \
--product ${{ env.CONFIG_JSON_PRODUCT }} \
--version ${{ env.CONFIG_JSON_VERSION }} \
--index-directory ${{ env.ARTIFACT_INDEXES }}/ \
2>&1 | tee algolia-update-index-log.txt