From f96f90cc6922a16611c2d250ba695546b3311fda Mon Sep 17 00:00:00 2001 From: Martin Wimpress <304639+flexiondotorg@users.noreply.github.com> Date: Thu, 9 Nov 2023 08:56:56 +0000 Subject: [PATCH] feat(ci): add build and publish workflow --- .github/workflows/publish-release.yml | 53 +++++++++++++++++++++++++++ deb-build.sh | 5 --- 2 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish-release.yml delete mode 100755 deb-build.sh diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000..caecead6 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,53 @@ +name: Build 🏗️ and Publish 📦️ + +on: + push: + tags: ['*'] + +jobs: + create-release: + name: Create Release + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Create release ${{ github.ref }} as a draft + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "${{ github.ref }}" --draft --generate-notes + + build-release: + needs: [create-release] + name: Build Release + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Build .deb + run: | + apt-get -y update + apt-get -y install debhelper devscripts + REL_VER=$(grep "^readonly VERSION" deb-get | cut -d'"' -f2) + dch -v "${REL_VER}-1" --distribution=unstable "New upstream release." + dpkg-buildpackage --build=binary --no-check-builddeps --compression=gzip + - name: Upload .deb + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + for artefact in "../"*_all.deb; do + gh release upload "${{ github.ref }}" "${artefact}" --clobber + done + + publish-release: + name: Publish Release + needs: [build-release] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Publish release ${{ github.ref }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ "$(gh release view "${{ github.ref }}" --json assets --template '{{len .assets}}')" -lt 0 ]; then + exit 1 + fi + gh release edit "${{ github.ref }}" --draft=false \ No newline at end of file diff --git a/deb-build.sh b/deb-build.sh deleted file mode 100755 index c6475a39..00000000 --- a/deb-build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -REL_VER=$(grep "^readonly VERSION" deb-get | cut -d'"' -f2) -dch -v "${REL_VER}-1" --distribution=unstable "New upstream release." -dpkg-buildpackage --build=binary --no-check-builddeps --compression=gzip