Update .github/workflows/build.yml
Some checks failed
Build Eleventy / build (push) Failing after 2m47s
Some checks failed
Build Eleventy / build (push) Failing after 2m47s
This commit is contained in:
parent
7d6a48ab40
commit
034add9a6a
1 changed files with 67 additions and 33 deletions
86
.github/workflows/build.yml
vendored
86
.github/workflows/build.yml
vendored
|
|
@ -1,33 +1,67 @@
|
||||||
- name: Publish to forgejo-pages
|
name: Build Eleventy
|
||||||
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"
|
|
||||||
|
|
||||||
# Build authenticated clone URL
|
on:
|
||||||
REPO_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
push:
|
||||||
AUTH_URL="$(echo "$REPO_URL" | sed "s#^https://#https://oauth2:${TOKEN}@#")"
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- 'maintenance/**'
|
||||||
|
- 'README.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- 'maintenance/**'
|
||||||
|
- 'README.md'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
git clone "$AUTH_URL" deploy
|
jobs:
|
||||||
cd deploy
|
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
|
- name: Set up Node.js
|
||||||
git checkout -B forgejo-pages origin/forgejo-pages
|
uses: actions/setup-node@v4
|
||||||
else
|
with:
|
||||||
git checkout --orphan forgejo-pages
|
node-version: "24"
|
||||||
git rm -rf . || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
- name: Publish to forgejo-pages
|
||||||
if ! git diff --cached --quiet; then
|
if: github.ref == 'refs/heads/main'
|
||||||
git commit -m "Deploy ${GITHUB_SHA}"
|
env:
|
||||||
git push origin forgejo-pages
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
fi
|
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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue