Update .github/workflows/build.yml
Some checks failed
build.yml / Update .github/workflows/build.yml (push) Failing after 0s
Some checks failed
build.yml / Update .github/workflows/build.yml (push) Failing after 0s
This commit is contained in:
parent
c011eacfa7
commit
7d6a48ab40
1 changed files with 33 additions and 69 deletions
48
.github/workflows/build.yml
vendored
48
.github/workflows/build.yml
vendored
|
|
@ -1,53 +1,20 @@
|
|||
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 }}
|
||||
REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
|
||||
run: |
|
||||
git config --global user.name "Forgejo Actions"
|
||||
git config --global user.email "actions@localhost"
|
||||
|
||||
# Clone repository
|
||||
git clone "https://oauth2:${TOKEN}@${REPO_URL#https://}" deploy
|
||||
# Build authenticated clone URL
|
||||
REPO_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
AUTH_URL="$(echo "$REPO_URL" | sed "s#^https://#https://oauth2:${TOKEN}@#")"
|
||||
|
||||
git clone "$AUTH_URL" deploy
|
||||
cd deploy
|
||||
|
||||
# Checkout or create forgejo-pages
|
||||
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
|
||||
|
|
@ -55,13 +22,10 @@ jobs:
|
|||
git rm -rf . || true
|
||||
fi
|
||||
|
||||
# Remove old files
|
||||
find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||
|
||||
# Copy new site
|
||||
cp -a ../docs/. .
|
||||
|
||||
# Commit and push if changed
|
||||
git add -A
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "Deploy ${GITHUB_SHA}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue