Compare commits

...

3 Commits

Author SHA1 Message Date
Lukas Greve
7e7b88ddff test workflow
Some checks failed
Build and Publish RPM / build-and-publish (push) Failing after 16s
2025-11-27 19:31:57 +01:00
Lukas Greve
a0e96cca72 remove dated workflow 2025-11-27 19:27:27 +01:00
Lukas Greve
9dcd38c8c5 fix 2025-11-27 19:27:08 +01:00
4 changed files with 83 additions and 53 deletions

View File

@@ -0,0 +1,82 @@
name: Build and Publish RPM
on:
push:
branches:
- main
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: Create build directory
run: |
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo "%_topdir %(echo $HOME)/rpmbuild" > ~/.rpmmacros
- name: Create source archive
run: |
tar -czf hello-0.0.1.tar.gz hello.sh
- name: Copy spec file
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
# 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
#

View File

@@ -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}}'

View File

@@ -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}}'

View File

@@ -26,4 +26,4 @@ cp %{name}.sh $RPM_BUILD_ROOT/%{_bindir}
%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