refactor: split build/release responsibilities and remove dist tracking
Generate Rules / build (push) Successful in 32s
Generate Rules / build (push) Successful in 32s
This commit is contained in:
@@ -15,7 +15,7 @@ on:
|
||||
- .gitea/workflows/generate-rules.yml
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -60,16 +60,3 @@ jobs:
|
||||
else
|
||||
python3 main.py --config config.json
|
||||
fi
|
||||
|
||||
- name: Commit and push dist changes
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -n "$(git status --porcelain dist)" ]; then
|
||||
git config user.name "gitea-actions[bot]"
|
||||
git config user.email "gitea-actions@localhost"
|
||||
git add dist
|
||||
git commit -m "chore: update generated rules"
|
||||
git push
|
||||
else
|
||||
echo "No changes in dist/"
|
||||
fi
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
missing=0
|
||||
for key in GITEA_BASE_URL GITEA_TOKEN SOURCE_OWNER SOURCE_REPO TARGET_OWNER TARGET_REPO; do
|
||||
for key in GITEA_BASE_URL GITEA_TOKEN TARGET_OWNER TARGET_REPO; do
|
||||
if [ -z "${!key}" ]; then
|
||||
echo "Missing required secret: $key" >&2
|
||||
missing=1
|
||||
@@ -32,8 +32,6 @@ jobs:
|
||||
env:
|
||||
GITEA_BASE_URL: ${{ secrets.GITEA_BASE_URL }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
SOURCE_OWNER: ${{ secrets.SOURCE_OWNER }}
|
||||
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
|
||||
TARGET_OWNER: ${{ secrets.TARGET_OWNER }}
|
||||
TARGET_REPO: ${{ secrets.TARGET_REPO }}
|
||||
|
||||
@@ -49,51 +47,25 @@ jobs:
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Build runtime config
|
||||
- name: Sync upstream Surge source
|
||||
if: steps.preflight.outputs.skip != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
SOURCE_REF="${SOURCE_REF:-main}"
|
||||
SOURCE_ROOT="${SOURCE_ROOT:-rule/Surge}"
|
||||
CLASH_NO_RESOLVE="${CLASH_NO_RESOLVE:-false}"
|
||||
MIHOMO_NO_RESOLVE="${MIHOMO_NO_RESOLVE:-false}"
|
||||
|
||||
cat > config.runtime.json <<JSON
|
||||
{
|
||||
"gitea": {
|
||||
"base_url": "${GITEA_BASE_URL}",
|
||||
"owner": "${SOURCE_OWNER}",
|
||||
"repo": "${SOURCE_REPO}",
|
||||
"ref": "${SOURCE_REF}",
|
||||
"token_env": "GITEA_TOKEN"
|
||||
},
|
||||
"source": {
|
||||
"root": "${SOURCE_ROOT}",
|
||||
"filename_pattern": "{name}.list",
|
||||
"include_categories": [],
|
||||
"exclude_categories": []
|
||||
},
|
||||
"output": {
|
||||
"dir": "dist",
|
||||
"clash_no_resolve": ${CLASH_NO_RESOLVE},
|
||||
"mihomo_no_resolve": ${MIHOMO_NO_RESOLVE}
|
||||
}
|
||||
}
|
||||
JSON
|
||||
UPSTREAM_REF="${UPSTREAM_REF:-master}"
|
||||
bash scripts/sync_surge_full.sh
|
||||
env:
|
||||
GITEA_BASE_URL: ${{ secrets.GITEA_BASE_URL }}
|
||||
SOURCE_OWNER: ${{ secrets.SOURCE_OWNER }}
|
||||
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
|
||||
SOURCE_REF: ${{ vars.SOURCE_REF }}
|
||||
SOURCE_ROOT: ${{ vars.SOURCE_ROOT }}
|
||||
CLASH_NO_RESOLVE: ${{ vars.CLASH_NO_RESOLVE }}
|
||||
MIHOMO_NO_RESOLVE: ${{ vars.MIHOMO_NO_RESOLVE }}
|
||||
UPSTREAM_REF: ${{ vars.UPSTREAM_REF }}
|
||||
|
||||
- name: Generate rules
|
||||
if: steps.preflight.outputs.skip != 'true'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: python3 main.py --config config.runtime.json
|
||||
run: |
|
||||
if [ -f config.toml ]; then
|
||||
python3 main.py --config config.toml
|
||||
else
|
||||
python3 main.py --config config.json
|
||||
fi
|
||||
|
||||
- name: Publish dist to target repo branch
|
||||
if: steps.preflight.outputs.skip != 'true'
|
||||
|
||||
Reference in New Issue
Block a user