From 034add9a6a2ba4c5111404e73561986fe9d3390b Mon Sep 17 00:00:00 2001 From: tenkuma Date: Wed, 13 May 2026 22:02:23 -0300 Subject: [PATCH] Update .github/workflows/build.yml --- .github/workflows/build.yml | 86 ++++++++++++++++++++++++++----------- 1 file changed, 60 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc9b2c8..4e10691 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,33 +1,67 @@ -- 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" +name: Build Eleventy - # Build authenticated clone URL - REPO_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" - AUTH_URL="$(echo "$REPO_URL" | sed "s#^https://#https://oauth2:${TOKEN}@#")" +on: + push: + branches: + - main + paths-ignore: + - 'maintenance/**' + - 'README.md' + pull_request: + paths-ignore: + - 'maintenance/**' + - 'README.md' + workflow_dispatch: - git clone "$AUTH_URL" deploy - cd deploy +jobs: + build: + runs-on: + - arch-linux - git fetch origin forgejo-pages || true + steps: + - name: Checkout repository + uses: actions/checkout@v4 - 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 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "24" - find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} + + - name: Install dependencies + run: npm ci - cp -a ../docs/. . + - name: Build site + run: npm run build - git add -A - if ! git diff --cached --quiet; then - git commit -m "Deploy ${GITHUB_SHA}" - git push origin forgejo-pages - fi \ No newline at end of file + - 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="${GITHUB_SERVER_URL}/${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 \ No newline at end of file