Simplify workflow for deploying new HTML pages #1362
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
| # A workflow to update the online issues lists. | |
| name: Generate HTML pages | |
| on: | |
| # This job must only be run when changes are pushed to the master branch! | |
| push: | |
| branches: [ master ] | |
| jobs: | |
| update-html-pages: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone XML sources | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ env.BRANCH }} | |
| # Using fetch-depth implies --single-branch so we don't fetch | |
| # the gh-pages branch (which avoids fetching 99% of the objects). | |
| fetch-depth: 2147483647 | |
| - name: Update issue timestamps | |
| run: make dates | |
| - name: Build programs | |
| run: make CXX=g++-14 pgms -j $(getconf _NPROCESSORS_ONLN) | |
| - name: Generate HTML lists | |
| run: make lists | |
| # Clone the gh-pages branch into a sub-directory. | |
| # The default fetch-depth:1 is OK for this step. | |
| - name: Clone repo again in order to push | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: 'gh-pages' | |
| path: 'gh-pages' | |
| clean: 'false' | |
| - name: Update online pages | |
| run: | | |
| : Push new HTML files to gh-pages branch | |
| mv mailing/*.html gh-pages/ | |
| rmdir mailing | |
| cd gh-pages | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| # Stage any changes to the individual issues (including new files): | |
| git add issue*.html | |
| # This only compares the staged changes, so ignores new timestamps | |
| # in the lwg-*.html files. The commit -a will pick those up though. | |
| printf '\nChecking HTML issues for changes ...\n' | |
| if git diff --cached --exit-code --name-status ; then | |
| echo 'No changes, not publishing new lists.' | |
| else | |
| printf '\nCommitting the changes above:\n' | |
| git commit -a -m 'Automatic update from GitHub Actions workflow' | |
| printf '\nPushing to the gh-pages branch:\n' | |
| git push | |
| fi | |
| cd .. |