Repository navigation
53 lines (47 loc) · 1.89 KB
/
Copy pathgithub_release.yml
File metadata and controls
53 lines (47 loc) · 1.89 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
49
50
51
52
53
name: Create GitHub Release
on:
push:
tags:
- "v*" # Trigger when a version tag is pushed (e.g., v1.0.0)
jobs:
create-release:
# Snapshot tags are never releases.
if: ${{ !endsWith(github.ref_name, '-SNAPSHOT') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v6
# The release notes are the version's section of the changelog. A
# prerelease usually has no section of its own yet, so it gets the
# unreleased one. If neither has anything, fall back to GitHub's
# generated notes rather than publish an empty release.
- name: Extract the release notes from the changelog
id: notes
run: |
extract() {
awk -v heading="$1" '
/^## / { if (found) exit; found = ($2 == heading); next }
found { print }
' CHANGELOG.md
}
extract "${GITHUB_REF_NAME#v}" > release-notes.md
if ! grep -q '[^[:space:]]' release-notes.md; then
extract main > release-notes.md
fi
if grep -q '[^[:space:]]' release-notes.md; then
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "::warning::No changelog section for $GITHUB_REF_NAME, using generated notes instead."
echo "found=false" >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
name: clojure-ts-mode ${{ github.ref_name }}
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }}
bodyFile: ${{ steps.notes.outputs.found == 'true' && 'release-notes.md' || '' }}
generateReleaseNotes: ${{ steps.notes.outputs.found != 'true' }}
token: ${{ secrets.GITHUB_TOKEN }}