Update .github/workflows/build.yml
Some checks failed
Build Eleventy / build (push) Failing after 4m31s
Some checks failed
Build Eleventy / build (push) Failing after 4m31s
This commit is contained in:
parent
dc8894386f
commit
c011eacfa7
1 changed files with 19 additions and 21 deletions
40
.github/workflows/build.yml
vendored
40
.github/workflows/build.yml
vendored
|
|
@ -15,7 +15,8 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: arch-linux
|
runs-on:
|
||||||
|
- arch-linux
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
@ -24,7 +25,7 @@ jobs:
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: "24"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -32,40 +33,37 @@ jobs:
|
||||||
- name: Build site
|
- name: Build site
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Publish to forgejo-pages branch
|
- name: Publish to forgejo-pages
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "Forgejo Actions"
|
git config --global user.name "Forgejo Actions"
|
||||||
git config --global user.email "actions@localhost"
|
git config --global user.email "actions@localhost"
|
||||||
|
|
||||||
# Clone target branch
|
# Clone repository
|
||||||
git clone \
|
git clone "https://oauth2:${TOKEN}@${REPO_URL#https://}" deploy
|
||||||
"https://oauth2:${TOKEN}@${{ github.server_url#https:// }}/${{ github.repository }}.git" \
|
|
||||||
deploy
|
|
||||||
|
|
||||||
cd deploy
|
cd deploy
|
||||||
|
|
||||||
# Switch to forgejo-pages branch, create if missing
|
# Checkout or create forgejo-pages
|
||||||
if git show-ref --verify --quiet refs/heads/forgejo-pages; then
|
git fetch origin forgejo-pages || true
|
||||||
git checkout forgejo-pages
|
if git ls-remote --exit-code --heads origin forgejo-pages >/dev/null 2>&1; then
|
||||||
|
git checkout -B forgejo-pages origin/forgejo-pages
|
||||||
else
|
else
|
||||||
git checkout --orphan forgejo-pages
|
git checkout --orphan forgejo-pages
|
||||||
git rm -rf .
|
git rm -rf . || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove old contents
|
# Remove old files
|
||||||
find . -mindepth 1 -maxdepth 1 \
|
find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||||
! -name '.git' \
|
|
||||||
-exec rm -rf {} +
|
|
||||||
|
|
||||||
# Copy new build output
|
# Copy new site
|
||||||
cp -r ../docs/. .
|
cp -a ../docs/. .
|
||||||
|
|
||||||
# Commit and push if there are changes
|
# Commit and push if changed
|
||||||
git add .
|
git add -A
|
||||||
if ! git diff --cached --quiet; then
|
if ! git diff --cached --quiet; then
|
||||||
git commit -m "Deploy from ${GITHUB_SHA}"
|
git commit -m "Deploy ${GITHUB_SHA}"
|
||||||
git push origin forgejo-pages
|
git push origin forgejo-pages
|
||||||
fi
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue