Publish precompiled wheels in Github release and add wheel index #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflows will upload a Python Package using twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
name: Build and Release Wheels | ||
on: [push] | ||
#on: | ||
# release: | ||
# types: [created] | ||
# branches: [main] | ||
jobs: | ||
# build wheels using action building.yml | ||
build_wheels: | ||
name: Call Composite Action | ||
uses: ./.github/actions/building | ||
create_release_and_upload_packages: | ||
name: Uplodad to Github Release | ||
needs: [build_sdist, build_wheels] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Extract version from version.py | ||
id: extract_version | ||
run: | | ||
VERSION=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' gsplat/version.py) | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
release_name: Release ${{ env.VERSION }} | ||
body: | | ||
Release notes for version ${{ env.VERSION }}. | ||
draft: false | ||
prerelease: false | ||
- name: Download packages | ||
id: download_artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: packages | ||
path: dist | ||
- name: Upload packages to GitHub Release | ||
id: upload_assets | ||
run: | | ||
for file in $(ls ./dist/*.*); do | ||
echo "Uploading $file..." | ||
filename=$(basename "$file") | ||
encoded_filename=$(echo "$filename" | sed 's/+/%2B/g') | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Content-Type: application/zip" \ | ||
--data-binary @"$file" \ | ||
"${{ steps.create_release.outputs.upload_url }}=$encoded_filename" | ||
done | ||
upload_pypi: | ||
name: Upload to PyPi | ||
needs: [build_sdist,build_wheels] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: source_package | ||
path: dist | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: no_binary_wheel | ||
path: dist | ||
- name: Publish package to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
- name: Publish package to PyPI | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
twine upload --username __token__ --password $PYPI_TOKEN dist/* |