Skip to content

Commit 29c3e40

Browse files
committed
release: Move changelog and release creation to GitHub Actions
release.sh now only bumps versions, builds, tags, and pushes. GitHub Actions triggers on tag push and handles: - Changelog generation (git-cliff) - GitHub release creation - RPM build (Fedora 43 container) - DEB build (Ubuntu) - Asset upload to release
1 parent 66dfe47 commit 29c3e40

File tree

2 files changed

+60
-29
lines changed

2 files changed

+60
-29
lines changed
Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,66 @@
1-
name: Build release packages
1+
name: Release
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
610

711
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
tag: ${{ steps.tag.outputs.tag }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get tag name
22+
id: tag
23+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
24+
25+
- name: Install git-cliff
26+
uses: kenji-miyake/setup-git-cliff@v2
27+
28+
- name: Generate changelog
29+
run: |
30+
git-cliff --config cliff.toml --unreleased --strip header \
31+
--tag "${{ steps.tag.outputs.tag }}" > /tmp/release-notes.md
32+
33+
- name: Create GitHub release
34+
env:
35+
GH_TOKEN: ${{ github.token }}
36+
run: |
37+
gh release create "${{ steps.tag.outputs.tag }}" \
38+
--title "${{ steps.tag.outputs.tag }}" \
39+
--notes-file /tmp/release-notes.md
40+
841
build-rpm:
42+
needs: create-release
943
runs-on: ubuntu-latest
1044
container: fedora:43
1145
steps:
1246
- uses: actions/checkout@v4
1347

1448
- name: Install dependencies
15-
run: dnf install -y rpm-build make gcc python3 curl
49+
run: dnf install -y rpm-build make gcc python3 curl git
1650

1751
- name: Build RPM
1852
run: make rpm
1953

2054
- name: Upload RPM to release
21-
uses: softprops/action-gh-release@v2
22-
with:
23-
files: rpmbuild/RPMS/noarch/*.rpm
55+
env:
56+
GH_TOKEN: ${{ github.token }}
57+
run: |
58+
dnf install -y gh
59+
gh release upload "${{ needs.create-release.outputs.tag }}" \
60+
rpmbuild/RPMS/noarch/*.rpm
2461
2562
build-deb:
63+
needs: create-release
2664
runs-on: ubuntu-latest
2765
steps:
2866
- uses: actions/checkout@v4
@@ -34,6 +72,8 @@ jobs:
3472
run: make deb
3573

3674
- name: Upload DEB to release
37-
uses: softprops/action-gh-release@v2
38-
with:
39-
files: "*.deb"
75+
env:
76+
GH_TOKEN: ${{ github.token }}
77+
run: |
78+
gh release upload "${{ needs.create-release.outputs.tag }}" \
79+
*.deb

release.sh

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -euo pipefail
44
# Release script for mediatek-mt7927-dkms.
55
#
66
# Bumps version across PKGBUILD, dkms.conf, and install script,
7-
# rebuilds the package, regenerates the changelog, and creates
8-
# a GitHub release with tag.
7+
# rebuilds the package, tags, and pushes. GitHub Actions handles
8+
# release creation, changelog, RPM/DEB builds, and asset upload.
99
#
1010
# Usage:
1111
# ./release.sh patch # bump pkgver minor (2.3 -> 2.4), reset pkgrel=1
@@ -110,11 +110,6 @@ echo ""
110110
echo "Building package..."
111111
aurgen
112112

113-
# Generate changelog
114-
echo ""
115-
echo "Generating changelog..."
116-
git-cliff --config cliff.toml --tag "${new_tag}" -o CHANGELOG.md
117-
118113
# Show what will be committed
119114
echo ""
120115
echo "Changes to commit:"
@@ -125,12 +120,12 @@ echo ""
125120
read -rp "Commit and release ${new_tag}? [y/N] " confirm
126121
if [[ "$confirm" != [yY] ]]; then
127122
echo "Aborted. Reverting version changes..."
128-
git checkout -- PKGBUILD dkms.conf mediatek-mt7927-dkms.install CHANGELOG.md
123+
git checkout -- PKGBUILD dkms.conf mediatek-mt7927-dkms.install
129124
exit 1
130125
fi
131126

132127
# Commit
133-
git add PKGBUILD dkms.conf mediatek-mt7927-dkms.install CHANGELOG.md .SRCINFO
128+
git add PKGBUILD dkms.conf mediatek-mt7927-dkms.install .SRCINFO
134129
git commit -m "pkg: Release ${new_tag}"
135130

136131
# Tag
@@ -140,24 +135,20 @@ git tag "${new_tag}"
140135
echo ""
141136
echo "Pushing to origin and aur..."
142137
git push origin master
138+
143139
# AUR rejects subdirectories (.github/). Create a filtered commit parented on
144140
# AUR's current master so the hook only sees clean commits.
145141
aur_tree=$(git ls-tree HEAD | grep -v '.github' | git mktree)
146142
aur_parent=$(git rev-parse aur/master)
147143
aur_commit=$(git commit-tree "${aur_tree}" -p "${aur_parent}" -m "Release ${new_tag}")
148144
git -c push.followTags=false push aur "${aur_commit}:refs/heads/master"
149-
git -c push.followTags=false push origin "${new_tag}"
150145

151-
# Create GitHub release
152-
echo ""
153-
echo "Creating GitHub release..."
154-
notes=$(git-cliff --config cliff.toml --unreleased --strip header --tag "${new_tag}")
155-
gh release create "${new_tag}" \
156-
--repo "$REPO" \
157-
--title "${new_tag}" \
158-
--notes "$notes"
146+
# Push tag — triggers GitHub Actions workflow which creates the release,
147+
# generates changelog, builds RPM/DEB, and attaches artifacts.
148+
git push origin "${new_tag}"
159149

160150
echo ""
161151
echo "Released ${new_tag}"
162152
echo " AUR: https://aur.archlinux.org/packages/mediatek-mt7927-dkms"
163-
echo " GitHub: https://github.com/${REPO}/releases/tag/${new_tag}"
153+
echo " GitHub Actions will create the release and build packages."
154+
echo " Track: https://github.com/${REPO}/actions"

0 commit comments

Comments
 (0)