web/.github/workflows/build.yml
tenkuma 00e4380563
Some checks failed
Build Eleventy / build (push) Failing after 2m35s
Atualizar .github/workflows/build.yml
2026-05-13 22:46:37 -03:00

67 lines
No EOL
1.6 KiB
YAML

name: Build Eleventy
on:
push:
branches:
- main
paths-ignore:
- 'maintenance/**'
- 'README.md'
pull_request:
paths-ignore:
- 'maintenance/**'
- 'README.md'
workflow_dispatch:
jobs:
build:
runs-on:
- arch-linux
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Install dependencies
run: npm ci
- name: Build site
run: npm run build
- name: Publish to forgejo-pages
if: github.ref == 'refs/heads/main'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "Forgejo Actions"
git config --global user.email "actions@localhost"
REPO_URL=https://inspiran.beetal-castor.ts.net/${GITHUB_REPOSITORY}.git"
AUTH_URL="$(printf '%s\n' "$REPO_URL" | sed "s#^https://#https://oauth2:${TOKEN}@#")"
git clone "$AUTH_URL" deploy
cd deploy
git fetch origin forgejo-pages || true
if git ls-remote --exit-code --heads origin forgejo-pages >/dev/null 2>&1; then
git checkout -B forgejo-pages origin/forgejo-pages
else
git checkout --orphan forgejo-pages
git rm -rf . || true
fi
find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
cp -a ../docs/. .
git add -A
if ! git diff --cached --quiet; then
git commit -m "Deploy ${GITHUB_SHA}"
git push origin forgejo-pages
fi