Add files via upload #2
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: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write # Add this to allow pushing to gh-pages | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: build | |
| env: | |
| GITHUB_PAT: ${{ github.token }} | |
| REPO: "getzola/zola" | |
| VERSION: "latest" | |
| MATCH: "zola-.+-x86_64-unknown-linux-gnu.tar.gz$" | |
| RENAME: "zola.tgz" | |
| shell: bash | |
| run: | | |
| curl -sL --fail \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| -H "Authorization: Bearer ${GITHUB_PAT}" \ | |
| "https://api.github.com/repos/${REPO}/releases/${VERSION}" \ | |
| | jq -r ".assets | .[] | select(.name | test(\"${MATCH}\")) | .url" \ | |
| | tee asset.url | |
| curl -sL --fail \ | |
| -H "Accept: application/octet-stream" \ | |
| -H "Authorization: Bearer ${GITHUB_PAT}" \ | |
| -o "${RENAME}" \ | |
| "$(cat asset.url)" | |
| tar -zxvf zola.tgz | |
| chmod +x zola | |
| ./zola build | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./public |