@@ -10,6 +10,7 @@ permissions:
1010
1111jobs :
1212 release :
13+ if : github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
1314 runs-on : ubuntu-24.04
1415
1516 steps :
@@ -43,34 +44,30 @@ jobs:
4344 - name : List downloaded files
4445 run : |
4546 echo "Artifacts downloaded:"
46- find artifacts -type f -print
47+ find artifacts -type f -exec readlink -f {} \;
4748
48- - name : Publish wheel to GitHub PyPI
49+ - name : Create GitHub Release
4950 run : |
50- pip install twine
51+ VERSION="${{ steps.changelog.outputs.version }}"
52+ VERSION="${VERSION%%-*}"
53+ TAG="v${VERSION}"
5154
52- # Create .pypirc
53- cat > ~/.pypirc <<EOF
54- [distutils]
55- index-servers =
56- github
55+ echo "Creating release for ${TAG}"
5756
58- [github]
59- repository = https://pypi.pkg.github.com/${{ github.repository_owner }}
60- username = __token__
61- password = ${{ secrets.GITHUB_TOKEN }}
62- EOF
57+ shopt -s globstar nullglob
6358
64- # Upload wheels from artifacts
65- twine upload --repository github artifacts/**/*.whl
59+ ASSETS=(
60+ artifacts/linux-amd64/build/**/*
61+ artifacts/linux-amd64/dist/**/*
62+ artifacts/linux-arm64/build/**/*
63+ artifacts/linux-arm64/dist/**/*
64+ )
6665
67- - name : Create GitHub release
68- uses : softprops/action-gh-release@v2
69- with :
70- tag_name : v${{ steps.changelog.outputs.version }}
71- name : Release v${{ steps.changelog.outputs.version }}
72- files : |
73- artifacts/linux-amd64/**
74- artifacts/linux-arm64/**
66+ echo "Uploading ${#ASSETS[@]} assets"
67+
68+ gh release create "$TAG" \
69+ --title "Release $TAG" \
70+ --notes "Automated release for version $TAG" \
71+ "${ASSETS[@]}"
7572 env :
76- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
73+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments