Skip to content

Commit f934e3a

Browse files
author
Luca Pisani
committed
Implement complete GitHub Actions CI for Notes project
- Release workflow: semantic versioning on main branch - Build snapshot: RPM snapshots on release/** branches - Build release: RPM releases on v* tags - Automated tagging and artifact uploads
1 parent 2c3805b commit f934e3a

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

.github/workflows/build-rpm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Build RPM
1+
name: Build Release
22

33
on:
44
push:
55
tags: [ 'v*' ] # Si attiva solo quando c'è un tag creato da semantic-release
66

77
jobs:
8-
build:
8+
build-release:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build Snapshot
2+
3+
on:
4+
push:
5+
branches: [ 'release/**' ]
6+
7+
jobs:
8+
build-snapshot:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Install dependencies
13+
run: |
14+
sudo apt update
15+
sudo apt install -y rpm
16+
- name: Get version
17+
run: |
18+
BRANCH_NAME=${GITHUB_REF#refs/heads/release/}
19+
VERSION="${BRANCH_NAME}-snapshot"
20+
echo "VERSION=$VERSION" >> $GITHUB_ENV
21+
- name: Create source tarball
22+
run: |
23+
tar -czf notes-${VERSION}.tar.gz --exclude=.git --exclude=.github .
24+
- name: Build RPM
25+
run: |
26+
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
27+
mv notes-${VERSION}.tar.gz ~/rpmbuild/SOURCES/
28+
rpmbuild -ba packaging/notes.spec --define "version $VERSION"
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: notes-${{ env.VERSION }}-snapshot.noarch.rpm
32+
path: ~/rpmbuild/RPMS/noarch/notes-${{ env.VERSION }}-snapshot.noarch.rpm

0 commit comments

Comments
 (0)