diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 29e7a6e..d7ccce9 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,7 +1,16 @@ name: Publish mllint's GitHub Pages website +# Runs on +# - pushes to master with changes to the files in docs/gh-pages or this file +# - release tags on: push: + branches: + - master + - mllint-site + paths: + - docs/gh-pages + - .github/workflows/gh-pages.yml tags: - "v*" @@ -40,13 +49,22 @@ jobs: - name: Generate Categories & Rules documentation run: go run ./docs/gh-pages/scripts/generate-docs.go - - name: Build website + - name: Build website (tagged version) + if: startsWith(github.ref, 'refs/tags/v') + working-directory: docs/gh-pages/ run: hugo --minify env: HUGO_MLLINT_VERSION: ${GITHUB_REF#refs/tags/v} + + - name: Build website (regular commit) + if: startsWith(github.ref, 'refs/heads/') + working-directory: docs/gh-pages/ + run: | + echo "HUGO_MLLINT_VERSION=$(git describe --tags)" >> $GITHUB_ENV + hugo --minify - name: Deploy website uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public \ No newline at end of file + publish_dir: ./docs/gh-pages/public/ \ No newline at end of file diff --git a/docs/gh-pages/.gitignore b/docs/gh-pages/.gitignore index 51b665a..4285e6f 100644 --- a/docs/gh-pages/.gitignore +++ b/docs/gh-pages/.gitignore @@ -3,3 +3,5 @@ /content/docs/rules/* !/content/docs/rules/_index.md + +/public/ diff --git a/docs/gh-pages/layouts/partials/extend_footer.html b/docs/gh-pages/layouts/partials/extend_footer.html index 2067092..260ca39 100644 --- a/docs/gh-pages/layouts/partials/extend_footer.html +++ b/docs/gh-pages/layouts/partials/extend_footer.html @@ -1,9 +1,20 @@ \ No newline at end of file