From 39cda7683d7713134d1db20e753b1c0677f535d4 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 28 Apr 2020 23:01:54 +0200 Subject: [PATCH] Publish release for release tags --- .github/workflows/build.yml | 23 ++++++++++++++++++++++- Makefile | 10 +++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ae6cb8..7e4913e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,9 +17,30 @@ jobs: submodules: recursive - name: Build Kernel run: make + - name: Read Build Information + id: read_build_info + run: | + echo "::set-output name=release::$(sed '1q;d' release.txt)" + echo "::set-output name=dst::$(sed '1q;d' artifacts.txt)" + echo "::set-output name=hdr::$(sed '2q;d' artifacts.txt)" + echo "::set-output name=tools::$(sed '3q;d' artifacts.txt)" + CHANGELOG=$(dpkg-parsechangelog -c 1 -l debian/changelog) - name: Upload Artifacts uses: actions/upload-artifact@v2-preview with: name: debs path: "*.deb" - + - name: Create Release + if: startsWith(github.ref, 'refs/tags/release') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + run: | + set -x + assets=() + for asset in ./*.deb; do + assets + =("-a" "$asset") + done + tag_name=${GITHUB_REF#"refs/tags/"} + release_name="${{ steps.read_build_info.outputs.release }}" + changelog=$(dpkg-parsechangelog -c 1 -l debian/changelog) + hub release create "${assets[@]}" -m "$release_name" -m "$changelog" "$tag_name" diff --git a/Makefile b/Makefile index 6113ebd..b5779b2 100644 --- a/Makefile +++ b/Makefile @@ -63,14 +63,22 @@ LINUX_TOOLS_DEB=linux-tools-$(KERNEL_MAJMIN)_${KERNEL_VER}-${PKGREL}_${ARCH}.deb DEBS=${DST_DEB} ${HDR_DEB} ${LINUX_TOOLS_DEB} -all: deb release.txt +all: deb release.txt artifacts.txt deb: ${DEBS} release.txt: echo "${KVNAME}" > release.txt + echo "${KERNEL_VER}" >> release.txt + echo "${PKGREL}" >> release.txt + echo "${ARCH}" >> release.txt echo "${PVE_BUILD_FLAVOR}" >> release.txt echo "${PVE_BUILD_TYPE}" >> release.txt +artifacts.txt: + echo "${DST_DEB}" > artifacts.txt + echo "${HDR_DEB}" >> artifacts.txt + echo "${LINUX_TOOLS_DEB}" >> artifacts.txt + ${LINUX_TOOLS_DEB} ${HDR_DEB}: ${DST_DEB} ${DST_DEB}: ${BUILD_DIR}.prepared cd ${BUILD_DIR}; dpkg-buildpackage --jobs=auto -b -uc -us