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 <noreply@anthropic.com>
This commit is contained in:
KenanZhuandClaude committed 2026-06-23 09:50:46 +08:00
1 parent 0ad7db124a
commit 84740fa081
1 file changed
+47
+47
View File
@@ -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 }}