Skip to content

Update Documentation #1827

Update Documentation

Update Documentation #1827

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 "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@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 "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)