-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (63 loc) · 2.66 KB
/
update-documentation.yaml
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
name: Update Documentation
on:
workflow_dispatch:
push:
branches:
- master
env:
STABLE_VERSION: '2.5'
AVAILABLE_VERSIONS: '["latest", "2.5", "2.4", "2.3", "2.2", "2.1", "2.0"]'
jobs:
build-styleguide:
name: Build styleguide for version ${{ matrix.version.version }} from ref ${{ matrix.version.ref }}
runs-on: ubuntu-latest
strategy:
matrix:
version:
- { ref: '2.6', version: 'latest' }
- { ref: '2.5', version: '2.5' }
- { ref: '2.4', version: '2.4' }
- { ref: '2.3.13', version: '2.3' }
- { ref: '2.2.19', version: '2.2' }
- { ref: '2.1.14', version: '2.1' }
- { ref: '2.0.12', version: '2.0' }
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Build styleguide
id: styleguide-build
continue-on-error: true
run: bin/build-styleguide ${{ matrix.version.ref }} ${{ matrix.version.version }} "$AVAILABLE_VERSIONS"
- name: Push styleguide
if: success() && steps.styleguide-build.outcome == 'success'
run: |
git pull --ff-only
git config user.email "[email protected]"
git config user.name "Sulu User"
git add docs/${{ matrix.version.version }}
git status
git diff --quiet && git diff --staged --quiet || git commit -m "Publish '${{ matrix.version.version }}'"
git push || (git pull --rebase && git push)
update-index:
name: Update index.html file
runs-on: ubuntu-latest
needs: build-styleguide
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Pull repository
run: git pull --ff-only
- name: Update index.html
run: echo "<!DOCTYPE html><html><body><script>window.location.href += '/$STABLE_VERSION';</script></body></html>" > docs/index.html
- name: Push index.html
run: |
git config user.email "[email protected]"
git config user.name "Sulu User"
git add docs/index.html
git status
git diff --quiet && git diff --staged --quiet || git commit -m "Update index.html file"
git push || (git pull --rebase && git push)