initial deploy CI

This commit is contained in:
Jacob Lifshay 2024-04-01 22:55:45 -07:00
parent a6eee7446d
commit 015493950a
Signed by: programmerjake
SSH key fingerprint: SHA256:B1iRVvUJkvd7upMIiMqn6OyxvD2SgJkAH3ZnUOj6z+c

View file

@ -0,0 +1,36 @@
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: |
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