Merge pull request #25 from nuttycom/zip-315-update #23
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
| # Inspired by https://nathan-at-least.github.io/auto-deploy-howto.html | |
| 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: Checkout repository | |
| uses: actions/checkout@v4.1.7 | |
| with: | |
| fetch-depth: 0 | |
| ssh-key: ${{ secrets.DEPLOY_KEY }} | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| # Each deploy overwrites the contents of `publish` branch from | |
| # `main`, but also introduces a merge structure so that the history of | |
| # `publish` is tracked: | |
| - name: Overwrite publish branch with main branch | |
| run: | | |
| set -x | |
| BASE_BRANCH="$(git rev-parse --abbrev-ref HEAD)" | |
| git config --global user.name 'autodeploy' | |
| git config --global user.email 'autodeploy' | |
| TMP='local-temp-branch' | |
| git checkout -b "$TMP" "$BASE_BRANCH" # Same tree state as main branch | |
| git merge origin/publish \ | |
| --commit -m 'Auto-deploy: merging "main" branch' | |
| git checkout publish | |
| git merge --ff-only "$TMP" | |
| git branch -d "$TMP" | |
| - name: Compile ZIPs and Zcash Protocol Specification | |
| uses: ./.github/actions/render | |
| - name: Commit and Push to "publish" branch | |
| uses: EndBug/add-and-commit@v9.1.4 | |
| with: | |
| add: 'rendered' | |
| default_author: github_actions | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'rendered' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |