45 lines
1.3 KiB
YAML
45 lines
1.3 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 dependencies
|
|
run: |
|
|
apt-get update -qq
|
|
apt-get install -qq dia python3
|
|
scripts/install_deps.sh
|
|
echo "`pwd`"/bin >> $GITHUB_PATH
|
|
- name: Build Book
|
|
run: |
|
|
mdbook-mermaid install .
|
|
mdbook build
|
|
- name: Push to rendered branch
|
|
run: |
|
|
hash="$(git log -n 1 --format=reference)"
|
|
git branch -D rendered &> /dev/null || true
|
|
git worktree add --detach --no-checkout dist
|
|
cd dist
|
|
git switch --orphan=rendered
|
|
cd ..
|
|
mv dist/.git book/.git
|
|
rmdir dist
|
|
mv book/ dist/
|
|
cd dist
|
|
git add .
|
|
git config user.name "CI"
|
|
git config user.email "ci@noreply.libre-chip.org"
|
|
git commit -n -m "rendered version of $hash"
|
|
[[ "${{ github.server_url }}" =~ ^"https://"(.*)$ ]]
|
|
git remote set-url origin "https://x-access-token:${{ github.token }}@${BASH_REMATCH[1]}/${{ github.repository }}"
|
|
git push -f origin rendered
|