Compare commits
8 Commits
ffb595ab41
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e3ae9181b | ||
|
|
916f80f8cb | ||
|
|
875f7e0d58 | ||
|
|
648ed2cbfd | ||
|
|
c31fd77db6 | ||
|
|
7e7b88ddff | ||
|
|
a0e96cca72 | ||
|
|
9dcd38c8c5 |
94
.gitea/workflows/build-publish-rpm.yaml
Normal file
94
.gitea/workflows/build-publish-rpm.yaml
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
name: Build and Publish RPM
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: fedora
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
container:
|
||||||
|
image: git.phyllo.me/devops/fedora-runner-image:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup RPM build environment
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/rpmbuild/{SOURCES,SPECS,BUILD,RPMS,SRPMS}
|
||||||
|
echo "%_topdir %(echo $HOME)/rpmbuild" > ~/.rpmmacros
|
||||||
|
|
||||||
|
- name: Check if hello.sh exists
|
||||||
|
run: |
|
||||||
|
if [ ! -f hello.sh ]; then
|
||||||
|
echo "ERROR: hello.sh file not found in repository"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- 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/
|
||||||
|
|
||||||
|
- name: Build RPM
|
||||||
|
run: |
|
||||||
|
cd ~/rpmbuild
|
||||||
|
rpmbuild -ba SPECS/hello.spec
|
||||||
|
|
||||||
|
- 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,21 +0,0 @@
|
|||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Use Go Action
|
|
||||||
id: use-go-action
|
|
||||||
uses: https://gitea.com/actions/release-action@main
|
|
||||||
with:
|
|
||||||
files: |-
|
|
||||||
bin/**
|
|
||||||
api_key: '${{secrets.RELEASE_TOKEN}}'
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: setup go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '>=1.20.1'
|
|
||||||
- name: release-build
|
|
||||||
run: go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/reverse-${{ github.ref_name }}-linux-amd64
|
|
||||||
- name: release-build-windows
|
|
||||||
run: GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/reverse-${{ github.ref_name }}-windows-amd64.exe
|
|
||||||
- name: release-build-darwin
|
|
||||||
run: GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/reverse-${{ github.ref_name }}-darwin-amd64
|
|
||||||
- name: Use Go Action
|
|
||||||
id: use-go-action
|
|
||||||
uses: actions/release-action@main
|
|
||||||
with:
|
|
||||||
files: |-
|
|
||||||
bin/**
|
|
||||||
api_key: '${{secrets.RELEASE_TOKEN}}'
|
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.aider*
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,7 +5,7 @@ Summary: A simple hello world script
|
|||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://git.phyllo.me/
|
URL: https://git.phyllo.me/
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Requires: bash
|
Requires: bash
|
||||||
@@ -19,11 +19,11 @@ A demo RPM build
|
|||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
|
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
|
||||||
cp %{name}.sh $RPM_BUILD_ROOT/%{_bindir}
|
cp hello.sh $RPM_BUILD_ROOT/%{_bindir}/hello
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%{_bindir}/%{name}.sh
|
%{_bindir}/hello
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Jul 09 2025 Lukas Greve <please@refre.ch> - 0.0.1
|
* Wed Jul 09 2025 Lukas Greve <please@refre.ch> - 0.0.1
|
||||||
- First version being packages
|
- First version being packaged
|
||||||
Reference in New Issue
Block a user