-
Notifications
You must be signed in to change notification settings - Fork 20
86 lines (67 loc) · 2.53 KB
/
release.yml
File metadata and controls
86 lines (67 loc) · 2.53 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Create Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get previous tag
id: previoustag
run: |
# Get the tag before the current one
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -A1 "${{ github.ref_name }}" | tail -n1)
echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
echo "Previous tag: $PREVIOUS_TAG"
- name: Generate changelog
id: changelog
run: |
PREVIOUS_TAG="${{ steps.previoustag.outputs.previous_tag }}"
CURRENT_TAG="${{ github.ref_name }}"
echo "Generating changelog from $PREVIOUS_TAG to $CURRENT_TAG"
# Generate commit log
CHANGELOG=$(git log ${PREVIOUS_TAG}..${CURRENT_TAG} --pretty=format:"- %s (%h)" --no-merges)
# Create multiline output
{
echo 'changelog<<EOF'
echo "$CHANGELOG"
echo EOF
} >> $GITHUB_OUTPUT
- name: Generate contributors list
id: contributors
run: |
PREVIOUS_TAG="${{ steps.previoustag.outputs.previous_tag }}"
CURRENT_TAG="${{ github.ref_name }}"
# Get unique contributors for this release (excluding repository owner)
CONTRIBUTORS=$(git log --pretty=format:"- @%an" --no-merges ${PREVIOUS_TAG}..${CURRENT_TAG} | sort -u | grep -v "deinfreu")
# Create multiline output
{
echo 'contributors<<EOF'
echo "$CONTRIBUTORS"
echo EOF
} >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
## Changes since ${{ steps.previoustag.outputs.previous_tag }}
${{ steps.changelog.outputs.changelog }}
---
## Contributors
A special thank you to everyone who contributed to this release!
${{ steps.contributors.outputs.contributors }}
I deeply appreciate every contribution.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}