| name: Update website | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| update-website: | |
| name: Update website | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.EMSCRIPTEN_BOT_TOKEN }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Checkout website repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: kripken/emscripten-site | |
| ref: gh-pages | |
| path: site/emscripten-site | |
| token: ${{ secrets.EMSCRIPTEN_BOT_TOKEN }} | |
| - name: pip install | |
| run: | | |
| which python3 | |
| python3 --version | |
| python3 -m pip install -r requirements-dev.txt | |
| - name: Update docs | |
| run: | | |
| set -o errexit | |
| set -o xtrace | |
| git config --global user.name emscripten-bot | |
| git config --global user.email emscripten-bot@users.noreply.github.com | |
| if ./tools/maint/update_website.py; then | |
| echo "update_website.py returned zero, expectations up-to-date" | |
| # Exit early and don't create a PR | |
| exit 0 | |
| else | |
| code=$? | |
| if [[ $code != 2 ]] ; then | |
| echo "update_website.py failed with unexpected error $code (expected 2)" | |
| exit 1 | |
| fi | |
| fi | |
| # Create a PR against the emscripten-site repo | |
| cd site/emscripten-site | |
| git push -f origin update | |
| gh pr create --fill --head update --base gh-pages --reviewer sbc100,kripken | |
| # Enable auto-submit. Currently there is no review requirement so | |
| # these changes are effectively landed with TBR. | |
| gh pr merge --squash --auto |