DistroHopper/.github/workflows/website.yml
2026-05-27 17:00:06 +02:00

69 lines
1.6 KiB
YAML

name: Build and deploy website
on:
push:
branches: [main]
paths:
- 'website-source/**'
- 'public/**'
- 'web-create'
- '.github/workflows/website.yml'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
outputs:
docs_changed: ${{ steps.diff.outputs.changed }}
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install Pandoc
run: |
#sudo apt-get update && sudo apt-get install -y pandoc
apt-get update && apt-get install -y pandoc
- name: Make pages
run: |
mkdir -p website
./web-create -b
- name: Check if docs changed
id: diff
run: |
if git diff --quiet HEAD~1 HEAD -- website/; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Deploy to website branch
run: |
git config --global user.name "oSoWoSo-bot"
git config --global user.email "mail@osowoso.org"
TMPDIR=$(mktemp -d)
cp -r website/. "$TMPDIR/"
git checkout --orphan website-tmp
git rm -rf . --quiet
cp -r "$TMPDIR/." .
git add -A
git commit -m "Deploy website from ${GITHUB_SHA::8}"
git push origin HEAD:website --force