Skip to content

Commit ce60363

Browse files
fix: resolve SDK version from gen.yaml when release drafter major is lower
During the 0.x → 1.0.0 migration, the release drafter resolves 0.54.0 because no 1.x release exists yet. The new resolve-version step uses gen.yaml's version when its major exceeds the drafter's, and falls back to the drafter for steady-state increments. Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent 7bf94c8 commit ce60363

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

.github/workflows/generate-command.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,39 @@ jobs:
147147
docker rm "$CONTAINER_ID" >/dev/null
148148
speakeasy --version
149149
150-
- name: Generate SDK with Speakeasy
150+
- name: Resolve SDK version
151+
id: resolve-version
151152
env:
152-
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
153-
VERSION: ${{ steps.get-version.outputs.resolved-version }}
153+
DRAFTER_VERSION: ${{ steps.get-version.outputs.resolved-version }}
154154
run: |
155-
if [ -z "$VERSION" ]; then
156-
echo "::error::Version resolution returned empty. Cannot proceed without an explicit version."
155+
GENYAML_VERSION=$(yq '.python.version' gen.yaml)
156+
echo "Release drafter version: ${DRAFTER_VERSION:-<empty>}"
157+
echo "gen.yaml version: ${GENYAML_VERSION:-<empty>}"
158+
# Use gen.yaml version if it is a higher major than the drafter
159+
# (handles initial major-version bumps before the first release).
160+
# Otherwise, prefer the release drafter's resolved version.
161+
DRAFTER_MAJOR=${DRAFTER_VERSION%%.*}
162+
GENYAML_MAJOR=${GENYAML_VERSION%%.*}
163+
if [ -n "$GENYAML_VERSION" ] && [ "${GENYAML_MAJOR:-0}" -gt "${DRAFTER_MAJOR:-0}" ]; then
164+
echo "version=${GENYAML_VERSION}" | tee -a $GITHUB_OUTPUT
165+
echo "Using gen.yaml version (higher major: ${GENYAML_MAJOR} > ${DRAFTER_MAJOR})"
166+
elif [ -n "$DRAFTER_VERSION" ]; then
167+
echo "version=${DRAFTER_VERSION}" | tee -a $GITHUB_OUTPUT
168+
echo "Using release drafter version"
169+
elif [ -n "$GENYAML_VERSION" ]; then
170+
echo "version=${GENYAML_VERSION}" | tee -a $GITHUB_OUTPUT
171+
echo "Falling back to gen.yaml version"
172+
else
173+
echo "::error::No version could be resolved from release drafter or gen.yaml."
157174
exit 1
158175
fi
159-
echo "Using version from release drafter: $VERSION"
176+
177+
- name: Generate SDK with Speakeasy
178+
env:
179+
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
180+
VERSION: ${{ steps.resolve-version.outputs.version }}
181+
run: |
182+
echo "Generating with version: $VERSION"
160183
uvx --from=poethepoet poe generate-code
161184
162185
- name: Post-generation patching

0 commit comments

Comments
 (0)