initial deploy CI
This commit is contained in:
parent
a6eee7446d
commit
015493950a
36
.forgejo/workflows/deploy.yml
Normal file
36
.forgejo/workflows/deploy.yml
Normal 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
|
Loading…
Reference in a new issue