Compare commits

..

5 Commits

Author SHA1 Message Date
Lukas Greve
3e3ae9181b Fixed source archive creation: Instead of directly tarring hello.sh, I now create a proper directory structure hello-0.0.1/ with the file inside, which is what %setup expects.
All checks were successful
Build and Publish RPM / build-and-publish (push) Successful in 5s
Fixed the %install section: Changed cp hello.sh $RPM_BUILD_ROOT/%{_bindir}/hello to remove the .sh extension as it's a more conventional name for executable files.

Fixed the %files section: Updated to reference %{_bindir}/hello instead of %{_bindir}/hello.sh
2025-11-27 20:04:25 +01:00
Lukas Greve
916f80f8cb add script
Some checks failed
Build and Publish RPM / build-and-publish (push) Failing after 4s
2025-11-27 20:02:14 +01:00
Lukas Greve
875f7e0d58 delete files
Some checks failed
Build and Publish RPM / build-and-publish (push) Failing after 4s
2025-11-27 19:56:17 +01:00
Lukas Greve
648ed2cbfd new workflow
Some checks failed
Build and Publish RPM / build-and-publish (push) Failing after 4s
2025-11-27 19:55:16 +01:00
Lukas Greve
c31fd77db6 feat: Add RPM build workflow and spec file for Gitea integration
Some checks failed
Build and Publish RPM / build-and-publish (push) Failing after 4s
Co-authored-by: aider (ollama_chat/qwen3-coder-30b-c24k) <aider@aider.chat>
2025-11-27 19:49:04 +01:00
7 changed files with 67 additions and 52 deletions

View File

@@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- 'v*'
jobs:
build-and-publish:
@@ -17,16 +19,26 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Create build directory
- name: Setup RPM build environment
run: |
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
mkdir -p ~/rpmbuild/{SOURCES,SPECS,BUILD,RPMS,SRPMS}
echo "%_topdir %(echo $HOME)/rpmbuild" > ~/.rpmmacros
- name: Create source archive
- name: Check if hello.sh exists
run: |
tar -czf hello-0.0.1.tar.gz hello.sh
if [ ! -f hello.sh ]; then
echo "ERROR: hello.sh file not found in repository"
exit 1
fi
- name: Copy spec file
- name: Create source archive with proper directory structure
run: |
# Create a proper directory structure for the tarball
mkdir -p hello-0.0.1
cp hello.sh hello-0.0.1/
tar -czf hello-0.0.1.tar.gz hello-0.0.1
- name: Copy spec file and source
run: |
cp hello.spec ~/rpmbuild/SPECS/
cp hello-0.0.1.tar.gz ~/rpmbuild/SOURCES/
@@ -36,47 +48,47 @@ jobs:
cd ~/rpmbuild
rpmbuild -ba SPECS/hello.spec
# - name: Publish RPM to Gitea
# run: |
# # Extract version from spec file
# VERSION=$(grep -E "^Version:" hello.spec | cut -d: -f2 | xargs)
# echo "Version: $VERSION"
#
# # Find built RPM
# RPM_FILE=$(find ~/rpmbuild -name "*.rpm" -type f | head -1)
# echo "RPM file: $RPM_FILE"
#
# # Publish to Gitea
# if [ -n "$GITEA_TOKEN" ] && [ -n "$GITEA_OWNER" ]; then
# curl -u "$GITEA_OWNER:$GITEA_TOKEN" \
# --upload-file "$RPM_FILE" \
# "https://gitea.example.com/api/packages/$GITEA_OWNER/rpm/upload"
# else
# echo "Missing GITEA_TOKEN or GITEA_OWNER environment variables"
# exit 1
# fi
#
# - name: Publish RPM with group
# if: ${{ contains(github.ref, 'v') }}
# run: |
# # Extract version from spec file
# VERSION=$(grep -E "^Version:" hello.spec | cut -d: -f2 | xargs)
# echo "Version: $VERSION"
#
# # Find built RPM
# RPM_FILE=$(find ~/rpmbuild -name "*.rpm" -type f | head -1)
# echo "RPM file: $RPM_FILE"
#
# # Publish to Gitea with group (using tag name as group)
# TAG_NAME=${GITHUB_REF#refs/tags/}
# echo "Publishing to group: $TAG_NAME"
#
# if [ -n "$GITEA_TOKEN" ] && [ -n "$GITEA_OWNER" ]; then
# curl -u "$GITEA_OWNER:$GITEA_TOKEN" \
# --upload-file "$RPM_FILE" \
# "https://gitea.example.com/api/packages/$GITEA_OWNER/rpm/$TAG_NAME/upload"
# else
# echo "Missing GITEA_TOKEN or GITEA_OWNER environment variables"
# exit 1
# fi
#
- name: Publish RPM to Gitea
if: github.ref_type == 'tag'
run: |
# Extract version from spec file
VERSION=$(grep -E "^Version:" hello.spec | cut -d: -f2 | xargs)
echo "Version: $VERSION"
# Find built RPM
RPM_FILE=$(find ~/rpmbuild -name "*.rpm" -type f | head -1)
echo "RPM file: $RPM_FILE"
# Publish to Gitea
if [ -n "$GITEA_TOKEN" ] && [ -n "$GITEA_OWNER" ]; then
curl -u "$GITEA_OWNER:$GITEA_TOKEN" \
--upload-file "$RPM_FILE" \
"https://gitea.example.com/api/packages/$GITEA_OWNER/rpm/upload"
else
echo "Missing GITEA_TOKEN or GITEA_OWNER environment variables"
exit 1
fi
- name: Publish RPM with group
if: github.ref_type == 'tag'
run: |
# Extract version from spec file
VERSION=$(grep -E "^Version:" hello.spec | cut -d: -f2 | xargs)
echo "Version: $VERSION"
# Find built RPM
RPM_FILE=$(find ~/rpmbuild -name "*.rpm" -type f | head -1)
echo "RPM file: $RPM_FILE"
# Publish to Gitea with group (using tag name as group)
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "Publishing to group: $TAG_NAME"
if [ -n "$GITEA_TOKEN" ] && [ -n "$GITEA_OWNER" ]; then
curl -u "$GITEA_OWNER:$GITEA_TOKEN" \
--upload-file "$RPM_FILE" \
"https://gitea.example.com/api/packages/$GITEA_OWNER/rpm/$TAG_NAME/upload"
else
echo "Missing GITEA_TOKEN or GITEA_OWNER environment variables"
exit 1
fi

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.aider*

Binary file not shown.

Binary file not shown.

2
hello.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
echo "Hello, World!"

View File

@@ -5,7 +5,7 @@ Summary: A simple hello world script
BuildArch: noarch
License: GPLv3+
URL: http://git.phyllo.me/
URL: https://git.phyllo.me/
Source0: %{name}-%{version}.tar.gz
Requires: bash
@@ -19,10 +19,10 @@ A demo RPM build
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
cp %{name}.sh $RPM_BUILD_ROOT/%{_bindir}
cp hello.sh $RPM_BUILD_ROOT/%{_bindir}/hello
%files
%{_bindir}/%{name}.sh
%{_bindir}/hello
%changelog
* Wed Jul 09 2025 Lukas Greve <please@refre.ch> - 0.0.1