chore: split validation and release workflows and refactor packaging

This commit is contained in:
KenanZhu committed 2026-10-11 09:53:25 +08:00
1 parent 5b06a795e4
commit 5f5ad058a8
9 files changed
+397 -505

No files matched your search

+35 -68
View File
@@ -2,44 +2,17 @@ name: Release
on:
push:
branches: [main]
tags: ['v*']
jobs:
validate:
name: Validate Templates
runs-on: linux-amd64-docker-small
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.x'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Test workflow scripts
run: python -B -m unittest discover -s .github/scripts -p 'test_*.py'
- name: Verify pinned official snapshot
working-directory: tools
run: |
go run . upstream prepare
go run . upstream verify
- name: Test — framework alignment and multilingual notification parity
working-directory: tools
run: go test ./...
- name: Build and render all themes and official languages
working-directory: tools
run: go run . preview all
name: Validate
uses: ./.github/workflows/validate.yml
permissions:
contents: read
package:
name: Package & Release
if: startsWith(github.ref, 'refs/tags/v')
name: Package
needs: validate
runs-on: linux-amd64-docker-small
permissions:
@@ -57,50 +30,44 @@ jobs:
with:
python-version: '3.11'
- name: Verify release tag matches the official snapshot
- name: Verify tag matches the snapshot
run: |
python -c 'import json, os; lock=json.load(open("gitea.lock.json")); assert lock["tag"] == os.environ["GITHUB_REF_NAME"], "Release tag must match the pinned Gitea tag"'
python - <<'PY'
import json
import os
- name: Verify release notes
run: test -s ".github/release-notes/${GITHUB_REF_NAME}.md"
with open("gitea.lock.json", encoding="utf-8") as lock_file:
lock = json.load(lock_file)
assert lock["tag"] == os.environ["GITHUB_REF_NAME"], (
"Release tag must match the pinned Gitea tag"
)
PY
- name: Generate static preview for the archive
- name: Generate preview
working-directory: tools
run: go run . preview all
- name: Package generated installable themes and multilingual preview
- name: Package themes and preview
run: python -B .github/scripts/package_release.py --version "$TEMPLATE_RELEASE"
env:
TEMPLATE_RELEASE: ${{ github.ref_name }}
- name: Create Release
run: python -B .github/scripts/gitea_actions.py publish-release --version "$TEMPLATE_RELEASE"
env:
TEMPLATE_RELEASE: ${{ github.ref_name }}
GITEA_SERVER_URL: ${{ github.server_url }}
GITEA_REPOSITORY: ${{ github.repository }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
notify-release-docs:
name: Remind to Update Release Documentation
if: startsWith(github.ref, 'refs/tags/v')
needs: package
concurrency:
group: release-documentation-${{ github.ref }}
cancel-in-progress: false
runs-on: linux-amd64-docker-small
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Prepare release runtime
uses: actions/setup-node@v4
with:
python-version: '3.11'
- name: Create documentation reminder Issue
run: python -B .github/scripts/gitea_actions.py create-issue --version "$TEMPLATE_RELEASE"
env:
TEMPLATE_RELEASE: ${{ github.ref_name }}
GITEA_SERVER_URL: ${{ github.server_url }}
GITEA_REPOSITORY: ${{ github.repository }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
node-version: '22'
- name: Release
uses: actions/gitea-release-action@v1.3.7
with:
server_url: ${{ github.server_url }}
repository: ${{ github.repository }}
token: ${{ secrets.GITEA_TOKEN }}
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body: ''
draft: false
prerelease: false
files: |
dist/gitea-mail-templates-${{ github.ref_name }}.zip
dist/gitea-mail-templates-${{ github.ref_name }}.tar.gz
+42
View File
@@ -0,0 +1,42 @@
name: Validate
on:
push:
branches: ['**']
pull_request:
workflow_call:
permissions:
contents: read
jobs:
validate:
name: Validate
runs-on: linux-amd64-docker-small
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.x'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Test workflow scripts
run: python -B -m unittest discover -s .github/scripts -p 'test_*.py'
- name: Verify snapshot
working-directory: tools
run: |
go run . upstream prepare
go run . upstream verify
- name: Tools test
working-directory: tools
run: go test ./...
- name: Build and render all themes and official languages
working-directory: tools
run: go run . preview all