From 9bb71ede9d56601702a89e034df2a11e9130685e Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 6 Sep 2024 16:11:52 +0200 Subject: [PATCH] Automatically build deb package on a new version tag (#801) In #796, I noticed that the deb package was not build since an automation was missing. With this PR, I add the missing automation. I tested the workflow in my repo... when starting the workflow manually: https://github.com/MrSerth/pgcat/actions/runs/10737879151/job/29780286094 when drafting a new release: https://github.com/MrSerth/pgcat/actions/runs/10737835796/job/29780146212 Obviously, both workflows failed since I cannot upload to the APT repo. However, the version substitution for the workflow is working correctly (as shown when collapsing the first line of the "Build and release package" step). --- .github/workflows/publish-deb-package.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-deb-package.yml b/.github/workflows/publish-deb-package.yml index 7729452..dbb7abd 100644 --- a/.github/workflows/publish-deb-package.yml +++ b/.github/workflows/publish-deb-package.yml @@ -1,6 +1,9 @@ name: pgcat package (deb) on: + push: + tags: + - v* workflow_dispatch: inputs: packageVersion: @@ -16,6 +19,14 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - name: Set package version + if: github.event_name == 'push' # For push event + run: | + TAG=${{ github.ref_name }} + echo "packageVersion=${TAG#v}" >> "$GITHUB_ENV" + - name: Set package version (manual dispatch) + if: github.event_name == 'workflow_dispatch' # For manual dispatch + run: echo "packageVersion=${{ github.event.inputs.packageVersion }}" >> "$GITHUB_ENV" - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -39,10 +50,10 @@ jobs: export ARCH=arm64 fi - bash utilities/deb.sh ${{ inputs.packageVersion }} + bash utilities/deb.sh ${{ env.packageVersion }} deb-s3 upload \ --lock \ --bucket apt.postgresml.org \ - pgcat-${{ inputs.packageVersion }}-ubuntu22.04-${ARCH}.deb \ + pgcat-${{ env.packageVersion }}-ubuntu22.04-${ARCH}.deb \ --codename $(lsb_release -cs)