Skip to content

Commit

Permalink
feat: valid, reproducible RPM package
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed Mar 21, 2024
1 parent f130230 commit 1672c1c
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/apk-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: Build APK package

on:
workflow_dispatch:
pull_request:

push:
paths-ignore:
- README.md
branches:
- "main"

Expand Down
Empty file removed .github/workflows/rpm-package.yml
Empty file.
2 changes: 2 additions & 0 deletions rpkg.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[rpkg]
user_macros = "${git_props:root}/rpkg.macros"
7 changes: 7 additions & 0 deletions rpkg.macros
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function studio-cli_version {
if [ "$GITHUB_REF_NAME" = "" ]; then
echo "0.1.0+$(git rev-parse --short HEAD)"
else
echo "$GITHUB_REF_NAME"
fi
}
29 changes: 29 additions & 0 deletions rpm.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-latest}"

FROM registry.fedoraproject.org/fedora:${FEDORA_MAJOR_VERSION} AS builder

ENV OUTPUT_ROOT=/app/output

WORKDIR /app

ADD . /app

RUN dnf install \
--disablerepo='*' \
--enablerepo='fedora,updates' \
--setopt install_weak_deps=0 \
--nodocs \
--assumeyes \
'dnf-command(builddep)' \
rpkg \
rpm-build && \
mkdir -p $OUTPUT_ROOT/{,output,atomic-studio/rpms} && \
rpkg spec --outdir "$OUTPUT_ROOT" && \
dnf builddep -y output/studio-cli.spec && \
rpkg local --outdir "$OUTPUT_ROOT/output" && \
mv ${OUTPUT_ROOT}/output/noarch/* "${OUTPUT_ROOT}/atomic-studio/rpms"

FROM scratch

ENV OUTPUT_ROOT=/app/output
COPY --from=builder ${OUTPUT_ROOT}/atomic-studio/rpms /rpms
40 changes: 40 additions & 0 deletions studio-cli.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Name: studio-cli
Vendor: atomic-studio-org
Version: {{{ studio-cli_version }}}
Release: 0%{?dist}
Summary: Manager for Atomic Studio
License: Apache-2.0
URL: https://github.com/%{vendor}/%{name}
# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS: {{{ git_dir_vcs }}}

# git_dir_pack macro places the repository content (the source files) into a tarball
# and returns its filename. The tarball will be used to build the rpm.
Source: {{{ git_dir_pack }}}

BuildArch: noarch
Supplements: podman

%description
Manages Atomic Studio installations

%global debug_package %{nil}
%global pname studio

%prep
{{{ git_dir_setup_macro }}}

%build

%install
mkdir -p %{_libexecdir}/studio-cli
install -D -m 0755 src/studio %{buildroot}%{_bindir}/%{pname}
cp -r src/libexec/* %{_libexecdir}/studio-cli

%files
%license LICENSE
%attr(0755,root,root) %{_bindir}/%{pname}

%changelog
%autochangelog

0 comments on commit 1672c1c

Please sign in to comment.