-
Notifications
You must be signed in to change notification settings - Fork 96
58 lines (51 loc) · 1.69 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
# This workflow builds changes to develop branch and commits to website repo
name: Generate website
on:
push:
branches: [develop]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out docs
uses: actions/checkout@v4
- name: Check out website
uses: actions/checkout@v4
with:
repository: dita-ot/website
token: ${{ secrets.COMMITTER_TOKEN }}
path: website
- name: Clean output
run: |
# Remove target output directory before generating new output
for i in `find "$SITE_DIR/dev" -type f`; do
if grep -q 'Generated from DITA source' "$i"; then
echo "Skip generated file $i"
elif grep -q 'generated: true' "$i"; then
echo "Skip generated file $i"
else
rm "$i"
fi
done
env:
SITE_DIR: ${{ github.workspace }}/website
- name: Render website
uses: ./.github/actions/render
- name: Reset unchanged
working-directory: ${{ github.workspace }}/website
run: |
ruby ${{ github.workspace }}/.github/workflows/clean.rb
- name: Push website
working-directory: ${{ github.workspace }}/website
run: |
if [ $(git status -s | wc -l) != 0 ]; then
git config user.email "ditaotbot@gmail.com"
git config user.name "DITA-OT Bot"
git add --all
# Commit generated site output
git commit -a -m "🚀 Deploy dita-ot/docs@${GITHUB_SHA:0:7} to 'dev' docs"
# push
git push -v origin master
else
echo "Nothing to commit"
fi