-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.78 KB
/
release.yaml
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
54
55
56
name: Release
on:
push:
branches: [main]
paths: ["CHANGELOG.md"]
permissions: write-all
jobs:
release:
runs-on: ubuntu-latest
env:
GO_VERSION: "1.23.0"
steps:
- uses: Kesin11/actions-timeline@v2
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum
- name: Extract Version
id: versioning
run: |
VERSION="v$(sed -n 's/##\s\([0-9.]*\)\s.*/\1/p' CHANGELOG.md | head -1)"
echo ::set-output name=version::$VERSION
- name: Extract changes from prev version
run: |
git fetch --prune --unshallow
PRETAG=$(git tag --sort -v:refname | head -1)
CURRENTTAG=${{ steps.versioning.outputs.version }}
echo "## What's Changed in ${CURRENTTAG}" > /tmp/diff-changelog.md
if [ -z "$PRETAG" ]
then
cat CHANGELOG.md | sed -e 's/##\s[0-9.]*\s.*//g' >> /tmp/diff-changelog.md
else
git diff $PRETAG..${{ github.sha }} -- CHANGELOG.md | grep -E '^\+' | grep -v '+++' | sed -e 's/^\+//g' | sed -e 's/##\s[0-9.]*\s.*//g' | sed -e '/^$/d' >> /tmp/diff-changelog.md
echo "" >> /tmp/diff-changelog.md
echo "**Full Changelog**: https://github.com/miyamo2/kubectl-create-transient_configmap /compare/${PRETAG}...${CURRENTTAG}" >> /tmp/diff-changelog.md
fi
- uses: goreleaser/goreleaser-action@v6
with:
workdir: .github/
version: latest
args: release --rm-dist --release-notes=/tmp/diff-changelog.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}