Skip to content

armgit / fli

Public Imported from GitHub
0

Google Flights MCP, CLI and Python Library

fix(release): build publish step from the new tag, not the caller SHA (#171)

Punit Arani9ef5ec570df9
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index e04a6fc..f64b422 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -20,6 +20,10 @@ on:
required: false
default: 'pypi'
type: string
+ ref:
+ description: 'Git ref (tag/branch/SHA) to build from. Required when called from release.yml so the build picks up the bump commit, not the caller-event SHA.'
+ required: false
+ type: string
permissions:
contents: read
@@ -29,6 +33,8 @@ permissions:
jobs:
test:
uses: ./.github/workflows/test.yml
+ with:
+ ref: ${{ inputs.ref }}
release-build:
needs: [ test ]
@@ -36,6 +42,8 @@ jobs:
steps:
- uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.ref || github.ref }}
- name: Install uv
uses: astral-sh/setup-uv@v7
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 13758b8..9a875a1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -235,6 +235,11 @@ jobs:
uses: ./.github/workflows/publish.yml
with:
environment: pypi
+ # Build from the new tag, not the caller-event SHA. workflow_call
+ # inherits the parent's github.sha (the SHA at release-dispatch time,
+ # before the bump commit lands), so without this the publish job would
+ # rebuild the previous version and PyPI would reject it as duplicate.
+ ref: ${{ needs.release.outputs.tag }}
permissions:
contents: read
checks: write
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 5c381ba..6d4bdcc 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -7,6 +7,11 @@ on:
branches: [ main ]
workflow_dispatch:
workflow_call:
+ inputs:
+ ref:
+ description: 'Git ref (tag/branch/SHA) to check out. Defaults to the caller ref.'
+ required: false
+ type: string
jobs:
lint:
@@ -18,6 +23,8 @@ jobs:
steps:
- uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.ref || github.ref }}
- name: Set up Python
uses: actions/setup-python@v6
@@ -90,6 +97,8 @@ jobs:
steps:
- uses: actions/checkout@v6
+ with:
+ ref: ${{ inputs.ref || github.ref }}
- name: Install uv
uses: astral-sh/setup-uv@v7