pve-kernel-thunderx/.github/workflows/release.yml
Fabian Mastenbroek 8b6ff9e36a
Trigger release on pull request completion
This change updates the release workflow to properly trigger when a pull
request on the appropriate branch is merged.
2021-05-02 15:27:07 +02:00

83 lines
2.8 KiB
YAML

name: Kernel Release
on:
pull_request:
types: [closed]
branches:
- v*
- flavor/*/v*
workflow_dispatch:
jobs:
build:
name: Build
runs-on: [self-hosted, build]
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
strategy:
matrix:
include:
- build_profile: 'generic'
build_cc: gcc
build_cflags: ''
steps:
- name: Clean Workspace
run: rm -rf *.deb *.ddeb *.build *.buildinfo *.changes
- name: Checkout Sources
uses: actions/checkout@v2
with:
submodules: recursive
path: pve-edge-kernel
- name: Clean Repository
run: git -C pve-edge-kernel submodule foreach git clean -ffdx
- name: Build Kernel
run: |
cd pve-edge-kernel
debian/rules debian/control
if [ "$PVE_BUILD_PROFILE" != "generic" ]; then
debchange -l +$PVE_BUILD_PROFILE -D edge --force-distribution -U -M "Specialization for $PVE_BUILD_PROFILE"
fi
debuild -e PVE* -e CCACHE_DIR=/var/cache/ccache --prepend-path=/usr/lib/ccache --jobs=auto -b -uc -us
env:
PVE_BUILD_PROFILE: ${{ matrix.build_profile }}
PVE_KERNEL_CC: ${{ matrix.build_cc }}
PVE_KERNEL_CFLAGS: ${{ matrix.build_cflags }}
PVE_ZFS_CC: ${{ matrix.build_cc }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2-preview
with:
name: debs-${{ matrix.build_profile }}
path: "*.deb"
publish:
name: Publish
runs-on: [ubuntu-latest]
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
needs: build
steps:
- name: Checkout Sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Delete Debug Symbols
run: rm -f artifacts/*/*dbgsym*.deb
- name: Format Release Name
id: format_release
run: |
release=$(scripts/version.sh)
echo "::set-output name=release::$release"
changelog=$(dpkg-parsechangelog -c 1 -l debian/changelog)
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "::set-output name=changelog::$changelog"
- name: Create Release
uses: ncipollo/release-action@v1
with:
commit: ${{ github.sha }}
tag: v${{ steps.format_release.outputs.release }}
body: ${{ steps.format_release.outputs.changelog }}
token: ${{ secrets.PAT }}
artifacts: "artifacts/debs-generic/pve-headers-*.deb,artifacts/debs-generic/linux-tools-*.deb,artifacts/debs-*/pve-kernel-*.deb"