From 7a9d9844f2e2536ef6db9dda83d97b7f77a4de56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E9=9C=87?= Date: Mon, 6 Apr 2026 14:46:50 +0800 Subject: [PATCH] feat: publish dist rules to a public mirror repo --- .gitea/workflows/publish-public-rules.yml | 86 +++++++++++++++++++++++ README.md | 12 ++++ 2 files changed, 98 insertions(+) create mode 100644 .gitea/workflows/publish-public-rules.yml diff --git a/.gitea/workflows/publish-public-rules.yml b/.gitea/workflows/publish-public-rules.yml new file mode 100644 index 000000000..635ae5e5d --- /dev/null +++ b/.gitea/workflows/publish-public-rules.yml @@ -0,0 +1,86 @@ +name: Publish Rules To Public Repo + +on: + workflow_dispatch: + push: + branches: + - main + +permissions: + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Validate required settings + shell: bash + env: + PUBLIC_REPO: ${{ vars.PUBLIC_REPO }} + PUBLIC_BRANCH: ${{ vars.PUBLIC_BRANCH }} + PUBLIC_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }} + run: | + set -euo pipefail + if [ -z "${PUBLIC_REPO:-}" ]; then + echo "Missing vars.PUBLIC_REPO (format: owner/repo)" >&2 + exit 1 + fi + if [ -z "${PUBLIC_TOKEN:-}" ]; then + echo "Missing secrets.PUBLIC_REPO_TOKEN" >&2 + exit 1 + fi + if [ -z "${PUBLIC_BRANCH:-}" ]; then + echo "PUBLIC_BRANCH not set, default to main" + fi + + - name: Checkout private source repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + github-server-url: https://git.halonice.com + + - name: Checkout public target repo + uses: actions/checkout@v4 + with: + repository: ${{ vars.PUBLIC_REPO }} + ref: ${{ vars.PUBLIC_BRANCH || 'main' }} + token: ${{ secrets.PUBLIC_REPO_TOKEN }} + path: public-repo + fetch-depth: 0 + github-server-url: https://git.halonice.com + + - name: Sync dist files + shell: bash + run: | + set -euo pipefail + mkdir -p public-repo/dist + rsync -a --delete dist/ public-repo/dist/ + cat > public-repo/README.md <