-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
# More assembly might be required: Docker logins, GPG, etc. It all depends | ||
# on your needs. | ||
# ${{ github.ref_name }} or $GITHUB_REF_NAME or ${{env.GITHUB_REF_NAME}} currently. | ||
- run: ./scripts/release-notes.sh ${{github.ref_name}} > ./release_notes.txt | ||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
# either 'goreleaser' (default) or 'goreleaser-pro': | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean --release-notes=./release_notes.txt | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' | ||
# distribution: | ||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,6 @@ | |
# Local testing | ||
.envrc | ||
*.FAIL | ||
|
||
dist/ | ||
release_notes.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# | ||
# See https://goreleaser.com/customization/ for more information. | ||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
|
||
archives: | ||
- format: binary | ||
name_template: >- | ||
{{ .ProjectName }}_{{- tolower .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else }}{{ .Arch }}{{ end }} | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
use: github-native |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
## [Unreleased] | ||
|
||
- No changes yet. | ||
- Add pre-built binaries with GoReleaser. | ||
|
||
## [v3.13.0] - 2023-06-29 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# Check if the required argument is provided | ||
if [ $# -lt 1 ]; then | ||
echo "Usage: $0 <semver version> [<changelog file>]" | ||
exit 1 | ||
fi | ||
|
||
version="$1" | ||
changelog_file="${2:-CHANGELOG.md}" | ||
|
||
# Check if the CHANGELOG.md file exists | ||
if [ ! -f "$changelog_file" ]; then | ||
echo "Error: $changelog_file does not exist" | ||
exit 1 | ||
fi | ||
|
||
CAPTURE=0 | ||
items="" | ||
while IFS= read -r LINE; do | ||
if [[ "${LINE}" == "##"* ]] && [[ "${CAPTURE}" -eq 1 ]]; then | ||
break | ||
fi | ||
if [[ "${LINE}" == "## [${version}]"* ]] && [[ "${CAPTURE}" -eq 0 ]]; then | ||
CAPTURE=1 | ||
continue | ||
fi | ||
if [[ "${CAPTURE}" -eq 1 ]]; then | ||
items+="$(echo "${LINE}" | xargs)" | ||
# if items is not empty, add a newline | ||
if [[ -n "$items" ]]; then | ||
items+=$'\n' | ||
fi | ||
fi | ||
done <"${changelog_file}" | ||
|
||
if [[ -n "$items" ]]; then | ||
echo "${items%$'\n'}" | ||
else | ||
echo "No changelog items found for version $version" | ||
fi |