Some checks failed
build.yml / Update .github/workflows/build.yml (push) Failing after 0s
33 lines
No EOL
963 B
YAML
33 lines
No EOL
963 B
YAML
- 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"
|
|
|
|
# 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
|
|
|
|
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 |