Skip to content

Commit 7bd37ab

Browse files
committed
Publish SRPM to GitHub releases when PRs are merged
Every time a PR lands on main, we now automatically create a GitHub release with the source RPM and checksums. Makes it easy to grab the latest build without having to clone and build yourself. Tags are formatted as v<version>+<commit> (e.g. v1.2.57+abc1234) so multiple merges at the same version don't step on each other. Signed-off-by: Jo5ta <Jo5ta@mail.de>
1 parent 94dc8ab commit 7bd37ab

1 file changed

Lines changed: 72 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ env:
1313
CONTAINER_CMD: docker
1414
CONTAINER_NON_INTERACTIVE: true
1515

16-
# Required for pushing to ghcr.io
16+
# Required for pushing to ghcr.io and creating releases
1717
permissions:
18-
contents: read
18+
contents: write
1919
packages: write
2020

2121
jobs:
@@ -88,3 +88,73 @@ jobs:
8888

8989
- name: Package Validate
9090
run: ./scripts/container.sh ./scripts/ci-cd/step_package_validate.sh --skip-srpm-rebuild
91+
92+
- name: Upload SRPM artifact
93+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: srpm
97+
path: build/packages/*.src.rpm
98+
retention-days: 1
99+
100+
# ============================================
101+
# Release (only on push to main)
102+
# ============================================
103+
release:
104+
runs-on: ubuntu-latest
105+
needs: package
106+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Download SRPM artifact
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: srpm
115+
path: packages
116+
117+
- name: Get version and generate release info
118+
id: release_info
119+
env:
120+
COMMIT_SHA: ${{ github.sha }}
121+
run: |
122+
VERSION=$(head -n1 VERSION.md)
123+
echo "version=$VERSION" >> $GITHUB_OUTPUT
124+
125+
# Create a unique tag using version + short commit hash
126+
SHORT_SHA=$(echo "$COMMIT_SHA" | cut -c1-7)
127+
echo "tag=v${VERSION}+${SHORT_SHA}" >> $GITHUB_OUTPUT
128+
129+
# Generate checksums
130+
cd packages
131+
sha256sum *.src.rpm > SHA256SUMS
132+
133+
# Build release body with checksums embedded
134+
cd ..
135+
cat > release_body.md << EOF
136+
Release of Common Low Level Tracing Kit
137+
138+
**Commit:** ${COMMIT_SHA}
139+
140+
## Install from SRPM
141+
\`\`\`bash
142+
rpmbuild --rebuild clltk-${VERSION}-*.src.rpm
143+
sudo dnf install ~/rpmbuild/RPMS/x86_64/clltk-*.rpm
144+
\`\`\`
145+
146+
## Checksums (SHA256)
147+
\`\`\`
148+
$(cat packages/SHA256SUMS)
149+
\`\`\`
150+
EOF
151+
152+
- name: Create Release
153+
uses: softprops/action-gh-release@v2
154+
with:
155+
tag_name: ${{ steps.release_info.outputs.tag }}
156+
name: ${{ steps.release_info.outputs.version }}
157+
body_path: release_body.md
158+
files: |
159+
packages/*.src.rpm
160+
packages/SHA256SUMS

0 commit comments

Comments
 (0)