new workflow
Some checks failed
Build and Publish RPM / build-and-publish (push) Failing after 4s

This commit is contained in:
Lukas Greve
2025-11-27 19:55:16 +01:00
parent c31fd77db6
commit 648ed2cbfd
2 changed files with 50 additions and 47 deletions

View File

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

1
.gitignore vendored Normal file
View File

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