96 lines
3.1 KiB
YAML
96 lines
3.1 KiB
YAML
name: Test Release Build
|
|
|
|
# Runs when the 'make-test-build' label is applied to a pull request,
|
|
# or on any subsequent commit while that label is present.
|
|
|
|
on:
|
|
pull_request:
|
|
types: [labeled, synchronize]
|
|
|
|
jobs:
|
|
test-release-build:
|
|
runs-on: ubuntu-latest
|
|
if: contains(github.event.pull_request.labels.*.name, 'make-test-build')
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Install build deps
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y devscripts debhelper build-essential dpkg-sig
|
|
|
|
- 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 Config.pm
|
|
run: |
|
|
BUILD_VERSION="${{ steps.version.outputs.build_version }}"
|
|
sed -i -E "s/^our \\\$VERSION\\s*=.*/our \\\$VERSION = '${BUILD_VERSION}';/" \
|
|
src/modules/node_info/files/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: Generate dynamic debian rules
|
|
run: |
|
|
bash build/gen-rules.sh >> debian/rules
|
|
|
|
- name: Build package
|
|
run: dpkg-buildpackage -us -uc -b
|
|
|
|
- name: Verify package contents
|
|
run: |
|
|
echo "=== Built files ==="
|
|
ls -la ../*.deb
|
|
echo ""
|
|
echo "=== Package info ==="
|
|
dpkg-deb --info ../*.deb
|
|
echo ""
|
|
echo "=== Package contents ==="
|
|
dpkg-deb --contents ../*.deb
|
|
|
|
- name: Import GPG key
|
|
if: env.GPG_PRIVATE_KEY != ''
|
|
env:
|
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
run: |
|
|
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
|
|
|
|
- name: Sign deb package
|
|
if: env.GPG_PRIVATE_KEY != ''
|
|
env:
|
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
|
|
run: |
|
|
DEB=$(ls ../*.deb)
|
|
dpkg-sig --sign builder -k "$GPG_KEY_ID" --gpg-options "--batch" "$DEB"
|
|
dpkg-sig --verify "$DEB"
|
|
|
|
- name: Collect deb artifacts
|
|
id: collect
|
|
run: |
|
|
mkdir -p artifacts
|
|
cp ../*.deb artifacts/
|
|
|
|
- name: Upload deb as artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: pve-mods-test-build-pr${{ github.event.pull_request.number }}-${{ steps.version.outputs.short_sha }}
|
|
path: artifacts/*.deb
|
|
retention-days: 3
|
|
patch-install-test:
|
|
needs: test-release-build
|
|
uses: ./.github/workflows/validate-mods.yml |