Merge pull request #1301 from daira/ironwood-zips #143
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: Deploy Rendered Site | |
| on: | |
| push: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run | |
| # in-progress and latest queued. However, do NOT cancel in-progress runs as we | |
| # want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| render-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate app token | |
| id: app-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| with: | |
| client-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: publish | |
| fetch-depth: 0 | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Verify nonexistence of `base_ref` | |
| shell: bash | |
| run: | | |
| if [ -e base_ref ]; then exit 1; fi | |
| - name: Set base ref | |
| run: | | |
| git show --format=%H --no-notes --no-patch 'HEAD' -- |tee base_ref | |
| if ! ( grep -E '^[0-9a-f]{40}$' base_ref ); then exit 1; fi | |
| - name: Setup Pages | |
| uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | |
| - name: Merge `main` to the `publish` branch | |
| run: | | |
| set -x | |
| git config --global user.name 'github_actions' | |
| git config --global user.email 'actions@github.com' | |
| version="$(git describe --tags --abbrev=6 origin/main |sed 's/-1-g.*//')" | |
| # Merge preferring the version in main. | |
| git merge -s recursive -Xtheirs origin/main --commit -m 'Auto-deploy: merging "main" branch' | |
| # Apply a tag to the merge commit, otherwise the uses of `git describe` in `protocol/Makefile` | |
| # won't find it. Any existing tag of the same name will be overwritten. | |
| git tag -f "${version}-auto" | |
| - name: Compile ZIPs and Zcash Protocol Specification | |
| uses: ./.github/actions/render | |
| - name: Set `.gitignore` to not ignore `rendered/` | |
| # This needs to be afer rendering so that it is not considered to make the tree dirty. | |
| run: sed -i 's@^rendered/$@@' .gitignore | |
| - name: Commit and push to `publish` branch | |
| uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10.0.0 | |
| with: | |
| add: 'rendered' | |
| default_author: github_actions | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| path: 'rendered' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |