-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.18 KB
/
Copy pathrelease.yaml
File metadata and controls
45 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
release:
runs-on: ubuntu-latest
if: startsWith(github.ref_name, 'v') && !contains(github.ref_name, '-')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find previous stable tag
id: prev_tag
run: |
PREV=$(git tag --sort=-version:refname \
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
| grep -v "^${{ github.ref_name }}$" \
| head -1)
echo "tag=${PREV}" >> $GITHUB_OUTPUT
- name: Generate release notes
run: |
PREV="${{ steps.prev_tag.outputs.tag }}"
if [ -z "$PREV" ]; then
touch release_notes.md
else
git log "${PREV}..${{ github.ref_name }}" \
--pretty=format:"- %s" \
--no-merges > release_notes.md
fi
- name: Create release
run: |
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--notes-file release_notes.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}