Skip to content

Commit 7c28443

Browse files
committed
Merge release workflow into build workflow
Move create-release, wheel-building, and PyPI publishing jobs into build.yaml with tag-only conditions. This fixes artifact availability since download-artifact only works within the same workflow run. The release.yaml was a separate workflow that couldn't access build artifacts. Now all build + release jobs share the same workflow run.
1 parent 89a1332 commit 7c28443

2 files changed

Lines changed: 175 additions & 230 deletions

File tree

.github/workflows/build.yaml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ permissions:
66
packages: write
77
issues: write
88
pull-requests: write
9+
id-token: write
910

1011
on:
1112
push:
1213
branches: [ main ]
14+
tags: [ 'v*' ]
1315
pull_request:
1416
branches: [ main ]
1517

@@ -329,3 +331,176 @@ jobs:
329331
files: integration_test_results.xml
330332
check_name: Integration Tests
331333
comment_mode: off
334+
335+
# -------------------------------------------------------------------------------------------------
336+
# Create GitHub Release + PyPI Wheels (tag pushes only)
337+
# -------------------------------------------------------------------------------------------------
338+
create-release:
339+
if: startsWith(github.ref, 'refs/tags/v')
340+
needs: [windows-build, linux-build, osx-universal-build, flapii-build]
341+
runs-on: ubuntu-24.04
342+
permissions:
343+
contents: write
344+
packages: write
345+
steps:
346+
- uses: actions/checkout@v4
347+
with:
348+
fetch-depth: 0
349+
350+
- name: Get tag version
351+
id: get_version
352+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
353+
354+
- name: Download all artifacts
355+
uses: actions/download-artifact@v4
356+
with:
357+
path: artifacts
358+
359+
- name: Prepare release assets
360+
run: |
361+
chmod +x ./artifacts/flapi-linux-amd64/flapi
362+
chmod +x ./artifacts/flapi-linux-arm64/flapi
363+
chmod +x ./artifacts/flapi-macos-arm64/flapi
364+
365+
cd artifacts/flapi-windows-amd64 && zip ../flapi-windows-amd64.zip flapi.exe && cd ../..
366+
cd artifacts/flapi-linux-amd64 && tar czf ../flapi-linux-amd64.tar.gz flapi && cd ../..
367+
cd artifacts/flapi-linux-arm64 && tar czf ../flapi-linux-arm64.tar.gz flapi && cd ../..
368+
cd artifacts/flapi-macos-arm64 && tar czf ../flapi-macos-arm64.tar.gz flapi && cd ../..
369+
370+
- name: Install bin-to-wheel
371+
run: pip install "bin-to-wheel @ git+https://github.com/DataZooDE/bin-to-wheel.git@main"
372+
373+
- name: Build flapi-io wheels
374+
run: |
375+
WHEEL_VERSION="${{ steps.get_version.outputs.VERSION }}"
376+
WHEEL_VERSION="${WHEEL_VERSION#v}"
377+
mkdir -p dist/flapi-io
378+
379+
bin-to-wheel --name flapi-io --version "$WHEEL_VERSION" \
380+
--binary ./artifacts/flapi-linux-amd64/flapi --platform linux-x86_64 \
381+
--output-dir dist/flapi-io --entry-point flapi \
382+
--description "SQL-to-API server" --author "DataZoo GmbH" \
383+
--license Apache-2.0 --url https://github.com/DataZooDE/flapi
384+
385+
bin-to-wheel --name flapi-io --version "$WHEEL_VERSION" \
386+
--binary ./artifacts/flapi-linux-arm64/flapi --platform linux-arm64 \
387+
--output-dir dist/flapi-io --entry-point flapi \
388+
--description "SQL-to-API server" --author "DataZoo GmbH" \
389+
--license Apache-2.0 --url https://github.com/DataZooDE/flapi
390+
391+
bin-to-wheel --name flapi-io --version "$WHEEL_VERSION" \
392+
--binary ./artifacts/flapi-macos-arm64/flapi --platform macos-arm64 \
393+
--output-dir dist/flapi-io --entry-point flapi \
394+
--description "SQL-to-API server" --author "DataZoo GmbH" \
395+
--license Apache-2.0 --url https://github.com/DataZooDE/flapi
396+
397+
bin-to-wheel --name flapi-io --version "$WHEEL_VERSION" \
398+
--binary ./artifacts/flapi-windows-amd64/flapi.exe --platform windows-x64 \
399+
--output-dir dist/flapi-io --entry-point flapi \
400+
--description "SQL-to-API server" --author "DataZoo GmbH" \
401+
--license Apache-2.0 --url https://github.com/DataZooDE/flapi
402+
403+
- name: Build flapii wheels
404+
run: |
405+
WHEEL_VERSION="${{ steps.get_version.outputs.VERSION }}"
406+
WHEEL_VERSION="${WHEEL_VERSION#v}"
407+
mkdir -p dist/flapii
408+
409+
chmod +x ./artifacts/flapii-linux-amd64/flapii
410+
chmod +x ./artifacts/flapii-linux-arm64/flapii
411+
chmod +x ./artifacts/flapii-macos-arm64/flapii
412+
413+
bin-to-wheel --name flapii --version "$WHEEL_VERSION" \
414+
--binary ./artifacts/flapii-linux-amd64/flapii --platform linux-x86_64 \
415+
--output-dir dist/flapii --entry-point flapii \
416+
--description "CLI client for flapi" --author "DataZoo GmbH" \
417+
--license MIT --url https://github.com/DataZooDE/flapi
418+
419+
bin-to-wheel --name flapii --version "$WHEEL_VERSION" \
420+
--binary ./artifacts/flapii-linux-arm64/flapii --platform linux-arm64 \
421+
--output-dir dist/flapii --entry-point flapii \
422+
--description "CLI client for flapi" --author "DataZoo GmbH" \
423+
--license MIT --url https://github.com/DataZooDE/flapi
424+
425+
bin-to-wheel --name flapii --version "$WHEEL_VERSION" \
426+
--binary ./artifacts/flapii-macos-arm64/flapii --platform macos-arm64 \
427+
--output-dir dist/flapii --entry-point flapii \
428+
--description "CLI client for flapi" --author "DataZoo GmbH" \
429+
--license MIT --url https://github.com/DataZooDE/flapi
430+
431+
bin-to-wheel --name flapii --version "$WHEEL_VERSION" \
432+
--binary ./artifacts/flapii-windows-amd64/flapii.exe --platform windows-x64 \
433+
--output-dir dist/flapii --entry-point flapii \
434+
--description "CLI client for flapi" --author "DataZoo GmbH" \
435+
--license MIT --url https://github.com/DataZooDE/flapi
436+
437+
- name: Upload flapi-io wheels
438+
uses: actions/upload-artifact@v4
439+
with:
440+
name: pypi-wheels-flapi-io
441+
path: dist/flapi-io/*.whl
442+
443+
- name: Upload flapii wheels
444+
uses: actions/upload-artifact@v4
445+
with:
446+
name: pypi-wheels-flapii
447+
path: dist/flapii/*.whl
448+
449+
- name: Create Release
450+
env:
451+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
452+
run: |
453+
TAG_MSG=$(git tag -l --format='%(contents)' ${{ steps.get_version.outputs.VERSION }})
454+
if [ -z "$TAG_MSG" ]; then
455+
TAG_MSG="Release ${{ steps.get_version.outputs.VERSION }}"
456+
fi
457+
458+
gh release create ${{ steps.get_version.outputs.VERSION }} \
459+
./artifacts/flapi-windows-amd64.zip \
460+
./artifacts/flapi-linux-amd64.tar.gz \
461+
./artifacts/flapi-linux-arm64.tar.gz \
462+
./artifacts/flapi-macos-arm64.tar.gz \
463+
./dist/flapi-io/*.whl \
464+
./dist/flapii/*.whl \
465+
--title "${{ steps.get_version.outputs.VERSION }}" \
466+
--notes "$TAG_MSG" \
467+
--draft=false \
468+
--prerelease=false
469+
470+
pypi-publish-flapi-io:
471+
if: startsWith(github.ref, 'refs/tags/v')
472+
needs: create-release
473+
runs-on: ubuntu-latest
474+
name: Publish flapi-io to PyPI
475+
environment:
476+
name: pypi-flapi-io
477+
url: https://pypi.org/p/flapi-io
478+
permissions:
479+
id-token: write
480+
steps:
481+
- name: Download wheels
482+
uses: actions/download-artifact@v4
483+
with:
484+
name: pypi-wheels-flapi-io
485+
path: dist
486+
- name: Publish to PyPI
487+
uses: pypa/gh-action-pypi-publish@release/v1
488+
489+
pypi-publish-flapii:
490+
if: startsWith(github.ref, 'refs/tags/v')
491+
needs: create-release
492+
runs-on: ubuntu-latest
493+
name: Publish flapii to PyPI
494+
environment:
495+
name: pypi-flapii
496+
url: https://pypi.org/p/flapii
497+
permissions:
498+
id-token: write
499+
steps:
500+
- name: Download wheels
501+
uses: actions/download-artifact@v4
502+
with:
503+
name: pypi-wheels-flapii
504+
path: dist
505+
- name: Publish to PyPI
506+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)