Skip to content

update readme

update readme #9

name: Generate Everything We Need And Push to Forgejo
on:
push:
branches: [ "main" ]
workflow_dispatch: {}
permissions:
contents: write
jobs:
build-and-generate:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci || npm install --no-audit --no-fund
- name: Generate YAML files
run: npm run generate
- name: Minify convert.js
run: npx --yes terser convert.js -o convert.min.js -c -m
- name: Commit changes
id: auto-commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "CI: Auto Generate Files"
- name: Push to Forgejo Mirror
env:
FORGEJO_PAT: ${{ secrets.FORGEJO_PAT }}
FORGEJO_REPO_URL: ${{ secrets.FORGEJO_REPO_URL }}
run: |
echo "Syncing to Forgejo..."
# 格式: https://<token>@your-forgejo-domain.com/user/repo.git
SYNC_URL=$(echo "$FORGEJO_REPO_URL" | sed "s|://|://$FORGEJO_PAT@|")
# 移除本地的 origin/HEAD 引用,防止推送到远程的 refs/heads/HEAD
git update-ref -d refs/remotes/origin/HEAD
# 使用 + 强制推送,解决 non-fast-forward 问题
git push --prune "$SYNC_URL" "+refs/remotes/origin/*:refs/heads/*" "+refs/tags/*:refs/tags/*"
echo "Sync completed."