69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
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: Test — mail template data contexts
|
|
working-directory: tools
|
|
run: go test ./...
|
|
|
|
- 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
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.21'
|
|
|
|
- name: Verify release notes
|
|
run: test -s ".github/release-notes/${GITHUB_REF_NAME}.md"
|
|
|
|
- name: Generate static preview for the archive
|
|
working-directory: tools
|
|
run: go run . preview all
|
|
|
|
- name: Package themes/
|
|
run: |
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
ARCHIVE="gitea-mail-templates-${VERSION}"
|
|
mkdir -p "dist/${ARCHIVE}/docs" "dist/${ARCHIVE}/preview"
|
|
cp -r themes LICENSE README.md CONTRIBUTING.md COMPATIBILITY.md "dist/${ARCHIVE}/"
|
|
cp docs/README.zh-CN.md docs/CONTRIBUTING.zh-CN.md "dist/${ARCHIVE}/docs/"
|
|
cp -r docs/images "dist/${ARCHIVE}/docs/"
|
|
cp preview/index.html preview/rendered.js "dist/${ARCHIVE}/preview/"
|
|
cd dist
|
|
zip -r "${ARCHIVE}.zip" "${ARCHIVE}"
|
|
tar -czf "${ARCHIVE}.tar.gz" "${ARCHIVE}"
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
files: dist/*.zip,dist/*.tar.gz
|
|
fail_on_unmatched_files: true
|
|
body_path: .github/release-notes/${{ github.ref_name }}.md
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|