Skip to content

Commit

Permalink
Add builds for RPMs alongside DEBs for Fedora and CentOS users (#15)
Browse files Browse the repository at this point in the history
* repo: add rpm packaging alongside deb packaging

* doc: add rpm docs to readme

* doc: fix typos in workflow

* fix: don't break your new workflow change

* fix: don't double-break your new workflow fix

* fix: the embed of the rpm filename

* repo: remove the whitespace in a workflow

* doc: remove trailing whitespace in spec

* doc: update wording in readme
  • Loading branch information
kyteware committed Jul 20, 2023
1 parent 1f2070f commit 6a008cb
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/on-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ jobs:
with:
go-version: "1.20.4"

- name: Build and package resetti
- name: Build and package resetti for debian
run: make deb

- name: Build and package resetti for redhat distros
run: make rpm

- name: Get rpm file name
id: rpm-filename
run: echo "::set-output name=filename::$(ls out | grep .rpm)"

- name: Upload artifact
env:
COMMIT: ${{ github.event.head_commit.message }}
Expand All @@ -30,5 +37,6 @@ jobs:
export COMMIT_NAME=$(echo "$COMMIT" | head -n 1)
curl -H 'Content-Type: multipart/form-data' -X POST \
-F "payload_json={\"username\": \"updates\", \"content\": \"($SHA) $COMMIT_NAME\"}" \
-F "file1=@out/resetti.deb" \
-F "file1=@out/resetti.deb" \
-F "file2=@out/${{ steps.rpm-filename.outputs.filename }}" \
"$WEBHOOK"
11 changes: 9 additions & 2 deletions .github/workflows/on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@ jobs:
with:
go-version: "1.20.4"

- name: Build and package resetti
- name: Build and package resetti for debian
run: make deb

- name: Build an package resetti from redhat distros
run: make rpm

- name: Get release info
id: tag
run: echo "::set-output name=tag::$(git describe --tags --abbrev=0)"

- name: Get rpm file name
id: rpm-filename
run: echo "::set-output name=filename::$(ls out | grep .rpm)"

- name: Publish release
uses: ncipollo/release-action@v1
with:
artifacts: "out/resetti.deb,out/resetti,out/bench"
artifacts: "out/resetti.deb,out/${{ steps.rpm-filename.outputs.filename }},out/resetti,out/bench"
draft: true
name: ${{ steps.tag.outputs.tag }}
tag: ${{ steps.tag.outputs.tag }}
Expand Down
41 changes: 41 additions & 0 deletions .pkg/resetti.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Name: resetti
Version: %{vernum}
Release: %{rel}

Summary: Minecraft multi-instance reset macro for speedrunning
License: GPLv3+
URL: http://www.github.com/woofdoggo/resetti

%description
resetti is a Linux-compatible reset macro for Minecraft speedruns. It supports a variety of different resetting styles, categories, and Minecraft versions.

You can refer to the documentation (https://github.com/woofdoggo/resetti/blob/main/doc/README.md) for detailed usage instructions.

Please report any bugs which you encounter. resetti is still beta software and is not guaranteed to work.

%prep

%build
%global _missing_build_ids_terminate_build 0

%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 out/%{name} %{buildroot}/%{_bindir}/%{name}
install -m 0755 out/bench %{buildroot}/%{_bindir}/%{name}-bench
mkdir -p %{buildroot}/%{_datadir}/%{name}
cp ./internal/res/cgroup_setup.sh %{buildroot}/%{_datadir}/%{name}
cp ./internal/res/default.toml %{buildroot}/%{_datadir}/%{name}
cp ./internal/res/scene-setup.lua %{buildroot}/%{_datadir}/%{name}

%files
%{_bindir}/%{name}
%{_bindir}/%{name}-bench
%license LICENSE
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/cgroup_setup.sh
%{_datadir}/%{name}/default.toml
%{_datadir}/%{name}/scene-setup.lua

%changelog
* Sun Jul 16 2023 Dworv <dwarvyt@gmail.com>
- Creation of RPM spec and workflow
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ deb: build
cp internal/res/scene-setup.lua out/deb/usr/local/share/resetti
dpkg-deb --build --root-owner-group out/deb out/resetti.deb

rpm: GOFLAGS=-ldflags="-X res.overrideDataDir=/usr/share/resetti"
rpm: build
mkdir -p out/rpm
@if git describe --exact-match HEAD; then \
echo "1" > out/rpm/.release; \
else \
git rev-parse --short HEAD > out/rpm/.release; \
fi
rpmbuild -ba --build-in-place --define "vernum $$(cut -d- -f1 < .version)" --define "rel $$(cat out/rpm/.release)" --define "_topdir $$(pwd)/out/rpm" .pkg/resetti.spec
mv out/rpm/RPMS/x86_64/* out

clean:
rm -r out
go clean
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ a variety of different resetting styles, categories, and Minecraft versions.

## Installation

Distribution specific packages are currently only limited to **Arch** and
**Debian-based** distributions. More distributions are planned for later.
Distribution specific packages are currently availible for **Arch**,
**Debian-based** and **RPM-based** distributions. More distributions are planned for later.

- [From the AUR](#from-the-aur)
- [From source](#from-source)
Expand All @@ -23,10 +23,10 @@ cd resetti
makepkg -si
```

### From the Debian package
### From distro-specific packages

Check the [Releases](https://github.com/woofdoggo/resetti/releases) tab for
Debian packages or download the latest development builds from the
distro-specific packages (deb or rpm) or download the latest development builds from the
[Discord](https://discord.gg/fwZA2VJh7k).

### From source
Expand Down

0 comments on commit 6a008cb

Please sign in to comment.