Update Documentation #1430
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |