Build, validate & deploy page #44684
This file contains hidden or 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, validate & deploy page | |
| on: | |
| schedule: | |
| - cron: "0 */1 * * *" | |
| push: | |
| branches: | |
| - gh-pages | |
| pull_request: | |
| branches: | |
| - gh-pages | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build and validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: π Set up Python 3.11 | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "3.11" | |
| - name: π Install requirements | |
| run: | | |
| pip install -r ./.github/scripts/requirements.txt | |
| - name: πΊ Refresh youtube thumbnails | |
| run: | | |
| chmod +x .github/scripts/fetch_yt_preview | |
| .github/scripts/fetch_yt_preview | |
| - name: π΅οΈββ Validate front matter | |
| run: | | |
| python .github/scripts/validate_front_matter.py --check-id-match --check-asset-match --action-output | |
| - name: π Enrich front matter | |
| if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request' | |
| run: | | |
| python ./.github/scripts/populate_additional_metadata.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.metadata_token }} | |
| - name: π Enrich notices | |
| if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request' | |
| run: | | |
| python ./.github/scripts/populate_additional_notices.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.metadata_token }} | |
| - name: π Enrich py2 check overlays | |
| if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request' | |
| run: | | |
| python ./.github/scripts/populate_py2_overlays.py | |
| - name: π Set up Ruby 3 | |
| uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1.313.0 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| - name: π¨ Build page | |
| run: | | |
| bundle exec jekyll build --future --trace | |
| - name: π΅οΈββοΈ Validate json files | |
| run: | | |
| [[ $(jq -er type _site/plugins.json) == "array" ]] | |
| [[ $(jq -er type _site/notices.json) == "array" ]] | |
| [[ $(jq -er type _site/search.json) == "object" ]] | |
| - name: π΅οΈββοΈ Validate ATOM feed | |
| run: | | |
| [[ $(yq --xml-strict-mode -ojson _site/feed.xml | jq -er type) == "object" ]] | |
| - name: β¬ Upload pages artifact | |
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| path: ./_site | |
| - name: π§ Discord success notification | |
| if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request' | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.discord_webhook }} | |
| run: | | |
| curl -H "Content-Type: application/json" -d '{"content": "βοΈ Page build for plugins.octoprint.org was successful"}' "$DISCORD_WEBHOOK" | |
| - name: π§ Discord failure notification | |
| if: failure() && github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request' | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.discord_webhook }} | |
| run: | | |
| curl -H "Content-Type: application/json" -d '{"content": "π« Page build for plugins.octoprint.org failed"}' "$DISCORD_WEBHOOK" | |
| deploy: | |
| name: "Deploy" | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.repository == 'OctoPrint/plugins.octoprint.org' && github.event_name != 'pull_request' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| permissions: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| contents: read | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |