Repository navigation
227 lines (184 loc) · 6.56 KB
/
Copy pathrelease.yml
File metadata and controls
227 lines (184 loc) · 6.56 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Create Linux Release
on:
workflow_dispatch:
inputs:
version_bump:
description: "Version bump type"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
release_notes:
description: "Custom release notes (optional; commit titles are used when empty)"
required: false
type: string
permissions:
contents: write
jobs:
version:
name: Calculate release version
runs-on: ubuntu-latest
outputs:
previous_tag: ${{ steps.version.outputs.previous_tag }}
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Calculate version
id: version
shell: bash
env:
VERSION_BUMP: ${{ inputs.version_bump }}
run: |
set -euo pipefail
previous_tag="$(git tag --sort=-v:refname | head -n 1 || true)"
if [[ -n "$previous_tag" ]]; then
current="${previous_tag#v}"
else
current="0.0.0"
fi
IFS='.' read -r major minor patch <<< "$current"
case "$VERSION_BUMP" in
major)
major=$((major + 1))
minor=0
patch=0
;;
minor)
minor=$((minor + 1))
patch=0
;;
patch)
patch=$((patch + 1))
;;
*)
echo "Unknown version bump: $VERSION_BUMP" >&2
exit 1
;;
esac
version="$major.$minor.$patch"
tag="v$version"
if git rev-parse "$tag" >/dev/null 2>&1; then
echo "Tag $tag already exists." >&2
exit 1
fi
echo "Previous tag: ${previous_tag:-none}"
echo "New version: $version"
echo "New tag: $tag"
echo "previous_tag=$previous_tag" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
release:
name: Build and publish release
needs: version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET 8
uses: actions/setup-dotnet@v6
with:
dotnet-version: "8.0.x"
- name: Build release packages
shell: bash
run: ./packaging/build-packages.sh "${{ needs.version.outputs.version }}"
- name: Create release notes
shell: bash
env:
CUSTOM_NOTES: ${{ inputs.release_notes }}
PREVIOUS_TAG: ${{ needs.version.outputs.previous_tag }}
NEW_TAG: ${{ needs.version.outputs.tag }}
VERSION: ${{ needs.version.outputs.version }}
run: |
set -euo pipefail
if [[ -n "$CUSTOM_NOTES" ]]; then
changes="$CUSTOM_NOTES"
elif [[ -n "$PREVIOUS_TAG" ]] && git rev-parse "$PREVIOUS_TAG" >/dev/null 2>&1; then
changes="$(git log --no-merges --pretty='format:- %s (`%h`)' "$PREVIOUS_TAG..$GITHUB_SHA")"
else
changes="$(git log --no-merges --pretty='format:- %s (`%h`)' "$GITHUB_SHA" -n 20)"
fi
if [[ -z "$changes" ]]; then
changes="- Package/release refresh."
fi
cat > release-notes.md <<EOF_NOTES
## FL Studio Discord RPC ${NEW_TAG}
Native Linux x86-64 packages. Installation and removal are handled by your distro package manager; `setup.sh` and `uninstall.sh` are no longer required.
### Install
**Debian / Ubuntu / Linux Mint**
\`\`\`bash
sudo apt install ./flstudiorpc_${VERSION}_amd64.deb
\`\`\`
**Fedora / RHEL-family**
\`\`\`bash
sudo dnf install ./flstudiorpc-${VERSION}-1.x86_64.rpm
\`\`\`
**Arch Linux / CachyOS / EndeavourOS**
\`\`\`bash
sudo pacman -U ./flstudiorpc-${VERSION}-1-x86_64.pkg.tar.zst
\`\`\`
### Uninstall
\`\`\`bash
# Debian / Ubuntu / Mint
sudo apt remove flstudiorpc
# Fedora / RHEL-family
sudo dnf remove flstudiorpc
# Arch Linux / CachyOS / EndeavourOS
sudo pacman -Rns flstudiorpc
\`\`\`
The package manager owns and removes the executable, application-menu entry, installed icons, and license file. Per-user preferences under \`~/.config\` are intentionally preserved.
### What's Changed
${changes}
### Files
- \`.deb\` for Debian, Ubuntu, Linux Mint and derivatives
- \`.rpm\` for Fedora/RHEL-family distributions
- \`.pkg.tar.zst\` for Arch Linux and derivatives
- \`SHA256SUMS\` for artifact verification
EOF_NOTES
cat release-notes.md
- name: Verify release assets
shell: bash
env:
VERSION: ${{ needs.version.outputs.version }}
run: |
set -euo pipefail
test -s "dist/flstudiorpc_${VERSION}_amd64.deb"
test -s "dist/flstudiorpc-${VERSION}-1.x86_64.rpm"
test -s "dist/flstudiorpc-${VERSION}-1-x86_64.pkg.tar.zst"
test -s "dist/SHA256SUMS"
ls -lh dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.version.outputs.tag }}
target_commitish: ${{ github.sha }}
name: FL Studio Discord RPC ${{ needs.version.outputs.tag }}
body_path: release-notes.md
files: |
dist/*.deb
dist/*.rpm
dist/*.pkg.tar.zst
dist/SHA256SUMS
fail_on_unmatched_files: true
draft: false
prerelease: false
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release summary
shell: bash
run: |
echo "### Release created" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- Version: **${{ needs.version.outputs.tag }}**" >> "$GITHUB_STEP_SUMMARY"
echo "- Previous: **${{ needs.version.outputs.previous_tag || 'none' }}**" >> "$GITHUB_STEP_SUMMARY"
echo "- Packages: DEB, RPM, Arch Linux" >> "$GITHUB_STEP_SUMMARY"
echo "- Release: https://github.com/${{ github.repository }}/releases/tag/${{ needs.version.outputs.tag }}" >> "$GITHUB_STEP_SUMMARY"