workflow: test build changes

This commit is contained in:
Meliox 2026-06-08 22:20:24 +02:00
parent 4c1a9486f1
commit 4c64f73518

View File

@ -20,15 +20,29 @@ jobs:
- name: Install build deps - name: Install build deps
run: sudo apt-get install -y devscripts debhelper build-essential run: sudo apt-get install -y devscripts debhelper build-essential
- name: Compute build version
id: version
run: |
BASE_VERSION=$(grep -m1 '(' debian/changelog | sed 's/.*(\(.*\)).*/\1/')
PR_NUMBER="${{ github.event.pull_request.number }}"
SHORT_SHA=$(git rev-parse --short HEAD)
BUILD_VERSION="${BASE_VERSION}+pr${PR_NUMBER}.${SHORT_SHA}"
echo "build_version=$BUILD_VERSION" >> "$GITHUB_OUTPUT"
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
echo "Building version: $BUILD_VERSION"
- name: Inject version into PVEMod_Config.pm - name: Inject version into PVEMod_Config.pm
run: | run: |
VERSION=$(grep -m1 '(' debian/changelog | sed 's/.*(\(.*\)).*/\1/') export BUILD_VERSION="${{ steps.version.outputs.build_version }}"
SHORT_SHA=$(git rev-parse --short HEAD)
export BUILD_VERSION="${VERSION}-test-${SHORT_SHA}"
perl -i -pe 'BEGIN { $v = $ENV{BUILD_VERSION} } perl -i -pe 'BEGIN { $v = $ENV{BUILD_VERSION} }
s/(our \$VERSION\s*=\s*'"'"')[^'"'"']*'"'"';/$1'"'"'$v'"'"';/ s/(our \$VERSION\s*=\s*'"'"')[^'"'"']*'"'"';/$1'"'"'$v'"'"';/
' src/PVENodeInfo/PVEMod_Config.pm ' src/PVENodeInfo/PVEMod_Config.pm
- name: Set package version in changelog
run: |
BUILD_VERSION="${{ steps.version.outputs.build_version }}"
sed -i -E "0,/\(([^)]*)\)/s//(${BUILD_VERSION})/" debian/changelog
- name: Build package - name: Build package
run: dpkg-buildpackage -us -uc -b run: dpkg-buildpackage -us -uc -b
@ -48,12 +62,10 @@ jobs:
run: | run: |
mkdir -p artifacts mkdir -p artifacts
cp ../*.deb artifacts/ cp ../*.deb artifacts/
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
- name: Upload deb as artifact - name: Upload deb as artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: pve-mods-test-build-${{ steps.collect.outputs.short_sha }} name: pve-mods-test-build-pr${{ github.event.pull_request.number }}-${{ steps.version.outputs.short_sha }}
path: artifacts/*.deb path: artifacts/*.deb
retention-days: 3 retention-days: 3