Update static site on wiki edit #92
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: Update static site on wiki edit | |
| on: [gollum, push] | |
| jobs: | |
| update-submodule: | |
| name: Update submodule | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v2 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| submodules: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update submodule | |
| run: | | |
| git submodule foreach git fetch --all | |
| git submodule foreach git reset --hard origin/master | |
| - name: Commit updated submodule | |
| uses: stefanzweifel/git-auto-commit-action@v4 | |
| with: | |
| commit_message: Updating based on latest wiki changes | |
| file_pattern: wiki .gitmodules | |
| build-static-pages: | |
| name: Build static pages | |
| needs: update-submodule | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v2 | |
| with: | |
| ref: ${{ github.ref }} | |
| submodules: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/configure-pages@v5 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Build site | |
| run: bundle exec rake | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3.0.1 | |
| with: | |
| path: ./build | |
| deploy: | |
| name: Deploy to Pages | |
| needs: build-static-pages | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| permissions: | |
| pages: write # to deploy to Pages | |
| id-token: write # to verify the deployment originates from an appropriate source | |
| environment: | |
| name: Github Pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |