-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 loc) · 1.64 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
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}" > diff-changelog.txt
if [ -z "$PRETAG" ]
then
cat CHANGELOG.md | sed -e 's/##\s[0-9.]*\s.*//g' >> diff-changelog.txt
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' >> diff-changelog.txt
echo "" >> diff-changelog.txt
echo "**Full Changelog**: https://github.com/miyamo2/r2/compare/${PRETAG}...${CURRENTTAG}" >> diff-changelog.txt
fi
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.versioning.outputs.version }}
generate_release_notes: false
body_path: diff-changelog.txt