-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.4 KB
/
release.yml
File metadata and controls
49 lines (43 loc) · 1.4 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
46
47
48
name: Release
on:
push:
tags:
- 'v*'
jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
id: tag_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Read release notes
id: release_notes
shell: bash
run: |
TAG="${GITHUB_REF#refs/tags/}"
# Check in releases/ directory first, then root for backwards compatibility
if [ -f "releases/RELEASE_NOTES_${TAG}.md" ]; then
NOTES=$(cat "releases/RELEASE_NOTES_${TAG}.md")
elif [ -f "RELEASE_NOTES_${TAG}.md" ]; then
NOTES=$(cat "RELEASE_NOTES_${TAG}.md")
else
NOTES="# Release ${TAG}\n\nSee [CHANGELOG.md](CHANGELOG.md) for details."
fi
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ steps.tag_version.outputs.VERSION }}
body: ${{ steps.release_notes.outputs.NOTES }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}