|
| 1 | +on: |
| 2 | +push: |
| 3 | +branches: |
| 4 | + -main |
| 5 | +name:Publish |
| 6 | +jobs: |
| 7 | +publish: |
| 8 | +runs-on:ubuntu-latest |
| 9 | +steps: |
| 10 | + -name:Check out source code |
| 11 | +uses:actions/checkout@v3 |
| 12 | +with: |
| 13 | +fetch-depth:0 |
| 14 | + -name:Install mdbook |
| 15 | +run:| |
| 16 | + mkdir mdbook |
| 17 | + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.26/mdbook-v0.4.26-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook |
| 18 | + echo `pwd`/mdbook >> $GITHUB_PATH |
| 19 | + -name:Generate book |
| 20 | +run:| |
| 21 | + ./generate-book.py |
| 22 | +# This cannot be safely offered before https://github.com/rust-lang/mdBook/issues/1238 is fixed. |
| 23 | +# - if: ${{ github.repository != 'amaranth-lang/rfcs' }} |
| 24 | +# name: Publish artifact to gh-pages branch in this repository |
| 25 | +# uses: JamesIves/github-pages-deploy-action@releases/v4 |
| 26 | +# with: |
| 27 | +# folder: book/ |
| 28 | +# branch: ${{ github.repository == 'amaranth-lang/rfcs' && 'pages' || 'gh-pages' }} |
| 29 | +# single-commit: true |
| 30 | + -if:${{ github.repository == 'amaranth-lang/rfcs' }} |
| 31 | +name:Publish artifact to https://amaranth-lang.org/rfcs/ |
| 32 | +run:| |
| 33 | + set -o pipefail |
| 34 | + cd book/ |
| 35 | + tar c * | zstd -T0 -1 | curl https://amaranth-lang.org/rfcs/ -X PUT -H "Authorization: Pages ${{ secrets.GREBEDOC_TOKEN }}" -H "Content-Type: application/x-tar+zstd" -T - |