diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..184cf44 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +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 + working-directory: graylog2-server/graylog2-web-interface/docs + run: | + yarn install + yarn run docs:build + cp -r styleguide/* $GITHUB_WORKSPACE/frontend-documentation + - name: Commit Results + working-directory: frontend-documentation + run: | + NUMBER_CHANGES=$(git status -s | wc -l) + if [[ $NUMBER_CHANGES -gt 0 ]]; then + git add -A + git commit -m "Update website to $SERVER_SHA" + git push origin gh-pages + else + echo "No changes made, skipping commit" + fi