yishentu--claudian
77 行
2.1 KiB
YAML
77 行
2.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
attestations: write
|
|
artifact-metadata: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Full history for changelog generation
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Validate release version
|
|
run: node scripts/check-release-version.mjs "${{ github.ref_name }}"
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Generate artifact attestations
|
|
uses: actions/attest@v4
|
|
with:
|
|
subject-path: |
|
|
main.js
|
|
manifest.json
|
|
styles.css
|
|
|
|
- name: Get previous tag
|
|
id: prev_tag
|
|
run: |
|
|
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
|
echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT
|
|
|
|
- name: Generate changelog
|
|
id: changelog
|
|
run: |
|
|
if [ -n "${{ steps.prev_tag.outputs.tag }}" ]; then
|
|
CHANGELOG=$(git log ${{ steps.prev_tag.outputs.tag }}..HEAD --pretty=format:"- %s" --no-merges | grep -v "^- ${{ github.ref_name }}$" || true)
|
|
else
|
|
CHANGELOG=$(git log --pretty=format:"- %s" --no-merges | head -20)
|
|
fi
|
|
# Handle multiline output
|
|
echo "notes<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
body: |
|
|
## What's Changed
|
|
${{ steps.changelog.outputs.notes }}
|
|
|
|
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.prev_tag.outputs.tag }}...${{ github.ref_name }}
|
|
files: |
|
|
main.js
|
|
manifest.json
|
|
styles.css
|