Skip to content

Commit 9bb71ed

Browse files
authored
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).
1 parent 88b2afb commit 9bb71ed

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/publish-deb-package.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: pgcat package (deb)
22

33
on:
4+
push:
5+
tags:
6+
- v*
47
workflow_dispatch:
58
inputs:
69
packageVersion:
@@ -16,6 +19,14 @@ jobs:
1619
runs-on: ${{ matrix.os }}
1720
steps:
1821
- uses: actions/checkout@v3
22+
- name: Set package version
23+
if: github.event_name == 'push' # For push event
24+
run: |
25+
TAG=${{ github.ref_name }}
26+
echo "packageVersion=${TAG#v}" >> "$GITHUB_ENV"
27+
- name: Set package version (manual dispatch)
28+
if: github.event_name == 'workflow_dispatch' # For manual dispatch
29+
run: echo "packageVersion=${{ github.event.inputs.packageVersion }}" >> "$GITHUB_ENV"
1930
- uses: actions-rs/toolchain@v1
2031
with:
2132
toolchain: stable
@@ -39,10 +50,10 @@ jobs:
3950
export ARCH=arm64
4051
fi
4152
42-
bash utilities/deb.sh ${{ inputs.packageVersion }}
53+
bash utilities/deb.sh ${{ env.packageVersion }}
4354
4455
deb-s3 upload \
4556
--lock \
4657
--bucket apt.postgresml.org \
47-
pgcat-${{ inputs.packageVersion }}-ubuntu22.04-${ARCH}.deb \
58+
pgcat-${{ env.packageVersion }}-ubuntu22.04-${ARCH}.deb \
4859
--codename $(lsb_release -cs)

0 commit comments

Comments
 (0)