Skip to content

Commit 014cedd

Browse files
jdeveraclaude
andcommitted
feat(ci): add Fedora COPR packaging
Add RPM spec, SRPM build Makefile, and COPR upload job to release workflow. On tag push, builds source RPM and submits to COPR for Fedora 42/43/44/Rawhide on x86_64 and aarch64. Install with: sudo dnf copr enable jdevera/git-this-bread Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 08d4036 commit 014cedd

4 files changed

Lines changed: 104 additions & 0 deletions

File tree

.copr/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.PHONY: srpm
2+
3+
SPEC := git-this-bread.spec
4+
5+
srpm:
6+
ifndef VERSION
7+
$(error VERSION is required, e.g. make srpm VERSION=1.0.0 outdir=/tmp)
8+
endif
9+
go mod vendor
10+
mkdir -p rpmbuild/SOURCES rpmbuild/SPECS
11+
tar czf rpmbuild/SOURCES/git-this-bread-$(VERSION).tar.gz \
12+
--transform 's,^\.,git-this-bread-$(VERSION),' \
13+
--exclude=.git --exclude=rpmbuild .
14+
sed 's/@@VERSION@@/$(VERSION)/g' $(SPEC) > rpmbuild/SPECS/$(SPEC)
15+
rpmbuild -bs rpmbuild/SPECS/$(SPEC) \
16+
--define "_topdir $(CURDIR)/rpmbuild" \
17+
--define "_sourcedir $(CURDIR)/rpmbuild/SOURCES"
18+
mv rpmbuild/SRPMS/*.src.rpm $(outdir)

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,42 @@ jobs:
3030
env:
3131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3232
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
33+
34+
copr:
35+
needs: release
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v6
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v6
43+
with:
44+
go-version-file: go.mod
45+
46+
- name: Install tools
47+
run: |
48+
sudo apt-get update -qq
49+
sudo apt-get install -y -qq rpm
50+
pip install copr-cli
51+
52+
- name: Configure copr-cli
53+
run: |
54+
mkdir -p ~/.config
55+
cat > ~/.config/copr <<EOF
56+
[copr-cli]
57+
login = ${{ secrets.COPR_LOGIN }}
58+
username = ${{ secrets.COPR_USERNAME }}
59+
token = ${{ secrets.COPR_TOKEN }}
60+
copr_url = https://copr.fedorainfracloud.org
61+
EOF
62+
63+
- name: Build source RPM
64+
run: |
65+
VERSION=${GITHUB_REF_NAME#v}
66+
make -f .copr/Makefile srpm \
67+
outdir=${{ github.workspace }} \
68+
VERSION="$VERSION"
69+
70+
- name: Upload source RPM to COPR
71+
run: copr-cli build git-this-bread ${{ github.workspace }}/*.src.rpm

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Binaries (at root only)
22
/git-*
3+
!/git-this-bread.spec
34
*.exe
45

56
# Build output
67
/dist/
8+
/rpmbuild/
9+
/vendor/
710

811
# Test binary, built with `go test -c`
912
*.test

git-this-bread.spec

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
%global goipath github.com/jdevera/git-this-bread
2+
%global debug_package %{nil}
3+
4+
Name: git-this-bread
5+
Version: @@VERSION@@
6+
Release: 1%{?dist}
7+
Summary: Git utilities for developers who knead to understand their repos
8+
9+
License: MIT
10+
URL: https://%{goipath}
11+
Source0: %{name}-%{version}.tar.gz
12+
13+
BuildRequires: golang >= 1.24
14+
15+
%description
16+
A collection of git and GitHub CLI utilities: git-explain (repo status
17+
analyzer), git-as/git-id/gh-as (identity management), and gh-wtfork
18+
(fork analyzer).
19+
20+
%prep
21+
%autosetup -n %{name}-%{version}
22+
23+
%build
24+
LDFLAGS="-s -w -X main.version=%{version}"
25+
for cmd in git-explain git-id git-as gh-as gh-wtfork; do
26+
GOFLAGS=-mod=vendor go build -ldflags "$LDFLAGS" -o "$cmd" "./cmd/$cmd"
27+
done
28+
29+
%install
30+
for cmd in git-explain git-id git-as gh-as gh-wtfork; do
31+
install -Dpm 0755 "$cmd" %{buildroot}%{_bindir}/"$cmd"
32+
done
33+
34+
%files
35+
%license LICENSE
36+
%{_bindir}/git-explain
37+
%{_bindir}/git-id
38+
%{_bindir}/git-as
39+
%{_bindir}/gh-as
40+
%{_bindir}/gh-wtfork
41+
42+
%changelog
43+
* Sun Mar 22 2026 Jacobo de Vera <73069+jdevera@users.noreply.github.com> - @@VERSION@@-1
44+
- See https://github.com/jdevera/git-this-bread/releases for release notes

0 commit comments

Comments
 (0)