website/.forgejo/workflows/deploy.yml

38 lines
1.1 KiB
YAML

name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: debian-12
permissions:
contents: write
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
with:
fetch-depth: 0
- name: Install latest mdbook
run: |
apt-get update -qq
apt-get install -qq --yes jq
tag="$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')"
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL "$url" | tar -xz --directory=./mdbook
echo "`pwd`"/mdbook >> $GITHUB_PATH
- name: Build Book
run: |
mdbook build
- name: Push to rendered branch
run: |
hash="$(git log -n 1 --format=reference)"
git branch -D rendered || true
git worktree add -b rendered --orphan dist
mv dist/.git book/.git
mv book/ dist/
cd dist
git add .
git commit -n -m "rendered version of $hash"
git push -f origin rendered