Build Frontend Gallery Periodically #334
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: Build Frontend Gallery Periodically | |
on: | |
schedule: | |
- cron: "0 4 * * *" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: frontend-documentation | |
ref: gh-pages | |
- uses: actions/checkout@v4 | |
with: | |
path: graylog2-server | |
repository: Graylog2/graylog2-server | |
- name: Prepare Github Pages Branch | |
working-directory: frontend-documentation | |
run: | | |
rm -r ./* | |
- name: Build Frontend Gallery | |
id: build | |
working-directory: graylog2-server/graylog2-web-interface | |
run: | | |
yarn install | |
cd docs | |
yarn install | |
yarn run docs:build | |
cp -r styleguide/* $GITHUB_WORKSPACE/frontend-documentation | |
SERVER_SHA=`git rev-parse HEAD` | |
echo "{serverSha}=${SERVER_SHA}" >> $GITHUB_OUTPUT | |
- name: Commit Results | |
working-directory: frontend-documentation | |
run: | | |
NUMBER_CHANGES=$(git status -s | wc -l) | |
if [[ $NUMBER_CHANGES -gt 0 ]]; then | |
git config --global user.email "[email protected]" | |
git config --global user.name "Gary Bot" | |
git add -A | |
git commit -m "Update website to ${{ steps.build.outputs.serverSha }}" | |
git push origin gh-pages | |
else | |
echo "No changes made, skipping commit" | |
fi |