File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : goreleaser
2+ on :
3+ push :
4+ tags :
5+ - " *"
6+ permissions :
7+ contents : write
8+ jobs :
9+ goreleaser :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ with :
14+ fetch-depth : 0
15+ - run : git fetch --force --tags
16+ - uses : actions/setup-go@v5
17+ with :
18+ go-version : stable
19+ - name : Generate release notes
20+ continue-on-error : true
21+ run : ./scripts/release-notes.sh ${{github.ref_name}} > ${{runner.temp}}/release_notes.txt
22+ - name : Run GoReleaser
23+ uses : goreleaser/goreleaser-action@v6
24+ with :
25+ distribution : goreleaser
26+ version : " ~> v2"
27+ args : release --clean --release-notes=${{runner.temp}}/release_notes.txt
28+ env :
29+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ # Changelog
2+
3+ All notable changes to this project will be documented in this file.
4+
5+ The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) , and this project
6+ adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7+
8+ ## [ Unreleased]
9+
10+ ### [ v1.0.0]
11+
12+ - Initial stable release. Production ready.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ # Check if the required argument is provided
6+ if [ $# -lt 1 ]; then
7+ echo " Usage: $0 <semver version> [<changelog file>]"
8+ exit 1
9+ fi
10+
11+ version=" $1 "
12+ changelog_file=" ${2:- CHANGELOG.md} "
13+
14+ # Check if the changelog file exists
15+ if [ ! -f " $changelog_file " ]; then
16+ echo " Error: $changelog_file does not exist"
17+ exit 1
18+ fi
19+
20+ CAPTURE=0
21+ items=" "
22+ # Read the changelog file line by line
23+ while IFS= read -r LINE; do
24+ # Stop capturing when we reach the next version sections
25+ if [[ " ${LINE} " == " ##" * ]] && [[ " ${CAPTURE} " -eq 1 ]]; then
26+ break
27+ fi
28+ # Stop capturing when we reach the Unreleased section
29+ if [[ " ${LINE} " == " [Unreleased]" * ]]; then
30+ break
31+ fi
32+ # Start capturing when we reach the specified version section
33+ if [[ " ${LINE} " == " ## [${version} ]" * ]] && [[ " ${CAPTURE} " -eq 0 ]]; then
34+ CAPTURE=1
35+ continue
36+ fi
37+ # Capture the lines between the specified version and the next version
38+ if [[ " ${CAPTURE} " -eq 1 ]]; then
39+ # Ignore empty lines
40+ if [[ -z " ${LINE} " ]]; then
41+ continue
42+ fi
43+ items+=" $( echo " ${LINE} " | xargs -0) "
44+ # Add a newline between each item
45+ if [[ -n " $items " ]]; then
46+ items+=$' \n '
47+ fi
48+ fi
49+ done < " ${changelog_file} "
50+
51+ if [[ -n " $items " ]]; then
52+ echo " ${items% $' \n ' } "
53+ else
54+ echo " No changelog items found for version $version "
55+ fi
You can’t perform that action at this time.
0 commit comments