33# This is a simplified version based on the autobahn-python workflow,
44# adapted for a pure Python package.
55#
6- name : Build and Publish
6+ name : wheels
77
88on :
9+ # Build wheels on feature branches and PRs (test only)
910 push :
10- branches :
11- - main
11+ branches : ["**"]
1212 pull_request :
13- branches :
14- - main
13+ branches : [main]
14+
15+ # Publish to GitHub Releases when merged to master
16+ # Publish to PyPI when tagged
17+ workflow_dispatch :
18+
19+ env :
20+ # Ensure uv and just are available in PATH
21+ UV_CACHE_DIR : ${{ github.workspace }}/.uv-cache
1522
1623jobs :
17- build :
18- name : Build sdist and wheel
24+ build-wheels :
25+ name : Build wheels
1926 runs-on : ubuntu-latest
2027
2128 steps :
@@ -39,13 +46,44 @@ jobs:
3946 name : python-package-distributions
4047 path : dist/
4148
42- publish-to-pypi :
43- name : Publish package to PyPI
44- needs :
45- - build
49+ publish-github-releases :
50+ name : Publish to GitHub Releases
51+ needs : build-wheels
52+ runs-on : ubuntu-latest
53+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
54+
55+ steps :
56+ - name : Download distribution package
57+ uses : actions/download-artifact@v4
58+ with :
59+ name : python-package-distributions
60+ path : dist/
61+
62+ - name : List all artifacts
63+ run : |
64+ echo "All built artifacts:"
65+ ls -la dist/
66+
67+ - name : Create GitHub Release
68+ env :
69+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
70+ run : |
71+ # Generate release tag based on timestamp and commit
72+ RELEASE_TAG="wheels-$(date +'%Y%m%d')-${{ GITHUB_SHA::8 }}"
73+
74+ # Create release
75+ gh release create "$RELEASE_TAG" \
76+ --repo "$GITHUB_REPOSITORY" \
77+ --title "Wheels Build - $(date +'%Y-%m-%d')" \
78+ --notes "Automated wheel build from commit ${{ GITHUB_SHA::8 }}" \
79+ dist/*
80+
81+ publish-pypi :
82+ name : Publish to PyPI
83+ needs : build-wheels
4684 runs-on : ubuntu-latest
4785 # Run only when a tag is pushed
48- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
86+ if : startsWith(github.ref, 'refs/tags/ ')
4987
5088 environment :
5189 name : pypi
63101
64102 - name : Publish package to PyPI
65103 uses : pypa/gh-action-pypi-publish@release/v1
104+ with :
105+ verbose : true
0 commit comments