-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (68 loc) · 3.1 KB
/
update-documentation.yaml
File metadata and controls
81 lines (68 loc) · 3.1 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
name: Update Documentation
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
env:
STABLE_VERSION: '2.6'
AVAILABLE_VERSIONS: '["latest", "2.6", "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: '3.0', version: 'latest', nodeVersion: '22.x' }
- { ref: '2.6', version: '2.6', nodeVersion: '20.x' }
- { ref: '2.5', version: '2.5', nodeVersion: '14.x' }
- { ref: '2.4.20', version: '2.4', nodeVersion: '12.x' }
- { ref: '2.3.13', version: '2.3', nodeVersion: '12.x' }
- { ref: '2.2.19', version: '2.2', nodeVersion: '12.x' }
- { ref: '2.1.14', version: '2.1', nodeVersion: '12.x' }
- { ref: '2.0.12', version: '2.0', nodeVersion: '12.x' }
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.version.nodeVersion }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version.nodeVersion }}
- 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' && github.ref == 'refs/heads/master'
run: |
git pull --ff-only
git config user.email "github@sulu.io"
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@v4
with:
ref: 'master'
- 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
if: ${{ github.ref == 'refs/heads/master' }}
run: |
git config user.email "github@sulu.io"
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)