Files
help/.gitea/workflows/publish.yml
T
gitea-actionsandClaude Opus 5 900194964b
Publish site / build-deploy (push) Failing after 1s
ci: spouštět na runneru se štítkem homelab
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 18:40:41 +02:00

64 lines
1.9 KiB
YAML

name: Publish site
on:
push:
branches: [main]
workflow_dispatch:
env:
QUARTO_VERSION: "1.10.18"
jobs:
build-deploy:
runs-on: homelab
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Quarto
run: |
set -e
curl -sSL -o /tmp/quarto.tar.gz \
"https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz"
mkdir -p "$HOME/opt"
tar -xzf /tmp/quarto.tar.gz -C "$HOME/opt"
echo "$HOME/opt/quarto-${QUARTO_VERSION}/bin" >> "$GITHUB_PATH"
- name: Render
run: quarto render
- name: Deploy to gh-pages
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
set -e
REMOTE="https://x-access-token:${TOKEN}@gitea.spacilovi.eu/${GITHUB_REPOSITORY}.git"
git config --global user.name "gitea-actions"
git config --global user.email "gitea-actions@spacilovi.eu"
# pracovní kopie gh-pages (zachová dosavadní historii větve)
if git ls-remote --exit-code "$REMOTE" gh-pages >/dev/null 2>&1; then
git fetch "$REMOTE" gh-pages
git worktree add /tmp/gh-pages FETCH_HEAD
cd /tmp/gh-pages
git checkout -B gh-pages
else
mkdir -p /tmp/gh-pages
cd /tmp/gh-pages
git init -q -b gh-pages
fi
# zahodit staré soubory (kromě .git) a nakopírovat nový build
find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
cp -a "${GITHUB_WORKSPACE}/_site/." .
touch .nojekyll
git add -A
if git diff --cached --quiet; then
echo "Beze změn, nic se nepublikuje."
exit 0
fi
git commit -q -m "Built site for gh-pages (${GITHUB_SHA::7})"
git push "$REMOTE" HEAD:gh-pages