Skip to content

Commit d615b01

Browse files
author
Daniele Briggi
committed
fix(workflow): python package triggered when main completes
1 parent c9bc16d commit d615b01

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build, test and release sqlite-vector
1+
name: Build, Test and Release
22
on:
33
push:
44
workflow_dispatch:

.github/workflows/python-package.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ on:
77
description: "Version to use for the Python package (e.g. 0.9.9)"
88
required: true
99
type: string
10-
release:
11-
types: [released]
10+
workflow_run:
11+
workflows: ["Build, Test and Release"]
12+
types:
13+
- completed
1214

1315
jobs:
1416
build-and-publish:
17+
if: |
18+
github.event_name == 'workflow_dispatch' ||
19+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main')
1520
runs-on: ${{ matrix.os }}
1621
permissions:
1722
id-token: write # mandatory for Pypi trusted publishing
@@ -65,8 +70,13 @@ jobs:
6570
- name: Get version
6671
id: get_version
6772
run: |
68-
if [[ "${{ github.event_name }}" == "release" ]]; then
69-
VERSION="${{ github.event.release.tag_name }}"
73+
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
74+
# Fetch latest published release tag from GitHub API
75+
VERSION=$(curl -s "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name')
76+
if [ "$VERSION" = "null" ] || [ -z "$VERSION" ]; then
77+
echo "Error: Failed to get latest release version"
78+
exit 1
79+
fi
7080
else
7181
VERSION="${{ github.event.inputs.version }}"
7282
fi

0 commit comments

Comments
 (0)