Skip to content

Commit

Permalink
[tzupdate] Add RPM spec
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeShortCloud committed Oct 11, 2024
1 parent abec95b commit 2ae52ea
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/tzupdate-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Upload tzupdate source RPM
on:
push:
branches:
- main
paths:
- 'tzupdate/**'
workflow_dispatch:

env:
PACKAGE_NAME: tzupdate

jobs:
upload:
name: Upload tzupdate source RPM to Fedora Copr
runs-on: ubuntu-22.04
container:
image: fedora:40
env:
FEDORA_COPR_LOGIN: ${{ secrets.FEDORA_COPR_LOGIN }}
FEDORA_COPR_TOKEN: ${{ secrets.FEDORA_COPR_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install RPM build dependencies
run: dnf install -y copr-cli rpm-build rpmdevtools
- name: Create the necessary RPM build directories
run: mkdir -p ~/rpmbuild/SOURCES/
- name: Copy internal source files
run: cp ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/* ~/rpmbuild/SOURCES/
- name: Download external source files
run: spectool -g -R ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/*.spec
- name: Build the source RPM
run: rpmbuild -bs ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/*.spec
- name: Create the local configuration directory
run: mkdir ~/.config/
- name: Create the copr-cli configuration file
run: |
cat <<EOF > ~/.config/copr
[copr-cli]
login = ${FEDORA_COPR_LOGIN}
username = playtron
token = ${FEDORA_COPR_TOKEN}
copr_url = https://copr.fedorainfracloud.org
EOF
- name: Upload the source RPM to Fedora Copr
run: copr-cli build gaming ~/rpmbuild/SRPMS/${PACKAGE_NAME}-*.src.rpm
38 changes: 38 additions & 0 deletions .github/workflows/tzupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Test tzupdate
on:
push:
branches-ignore:
- main
paths:
- 'tzupdate/**'

env:
PACKAGE_NAME: tzupdate

jobs:
test:
name: Test gamescope-session-playtron RPM build
runs-on: ubuntu-22.04
container:
image: fedora:40
steps:
- uses: actions/checkout@v3
- name: Install RPM build dependencies
run: dnf install -y copr-cli rpm-build rpmdevtools
- name: Create the necessary RPM build directories
run: mkdir -p ~/rpmbuild/SOURCES/
- name: Copy internal source files
run: cp ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/* ~/rpmbuild/SOURCES/
- name: Download external source files
run: spectool -g -R ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/${PACKAGE_NAME}.spec
- name: Build the source RPM
run: rpmbuild -bs ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/${PACKAGE_NAME}.spec
- name: Install the DNF build dependencies plugin
run: dnf -y install 'dnf-command(builddep)'
- name: Install the required build dependencies.
run: dnf builddep -y ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/${PACKAGE_NAME}.spec
- name: Build the binary RPM
run: rpmbuild -bb ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/${PACKAGE_NAME}.spec
- name: Install RPMs
run: dnf -y install ~/rpmbuild/RPMS/*/*.rpm
32 changes: 32 additions & 0 deletions tzupdate/tzupdate.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Name: tzupdate
Version: 3.1.0
Release: 1%{?dist}
Summary: A command to automatically set the timezone based on GeoIP information
License: MIT
URL: https://github.com/cdown/tzupdate
Source0: https://github.com/cdown/tzupdate/archive/refs/tags/%{version}.tar.gz
BuildRequires: cargo rust

# Disable the unused debug package.
%global debug_package %{nil}

%description
%{summary}.

%prep
%setup -q -c

%build
cd tzupdate-%{version}
cargo build --release

%install
mkdir -p %{buildroot}/usr/bin
cp tzupdate-%{version}/target/release/tzupdate %{buildroot}/usr/bin/

%files
/usr/bin/tzupdate

%changelog
* Fri Oct 11 2024 Luke Short <[email protected]> 3.1.0-1
- Initial RPM spec created

0 comments on commit 2ae52ea

Please sign in to comment.