From 84740fa081793d6e19693d019899f3fc2af1263a Mon Sep 17 00:00:00 2001 From: KenanZhu <3471685733@qq.com> Date: Tue, 23 Jun 2026 09:50:46 +0800 Subject: [PATCH] ci: add release workflow with template lint and artifact packaging - Validate all templates on push to main and tag v* - On tag: package themes/ as zip + tar.gz and create GitHub release Co-Authored-By: Claude --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aa67cde --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release + +on: + push: + branches: [main] + tags: ['v*'] + +jobs: + validate: + name: Validate Templates + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: Lint — render all templates + working-directory: tools + run: go run . preview all + + package: + name: Package & Release + if: startsWith(github.ref, 'refs/tags/v') + needs: validate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Package themes/ + run: | + VERSION=${GITHUB_REF#refs/tags/} + ARCHIVE="gitea-mail-templates-${VERSION}" + mkdir -p dist + cp -r themes LICENSE README.md "dist/${ARCHIVE}" + cd dist + zip -r "${ARCHIVE}.zip" "${ARCHIVE}" + tar -czf "${ARCHIVE}.tar.gz" "${ARCHIVE}" + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: dist/*.zip,dist/*.tar.gz + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}