release #27
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
on: | |
- workflow_dispatch | |
name: release | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-20.04 , windows-2019, macos-12 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get proton-python-driver tag | |
id: get_tag_name | |
if: ${{ !startsWith( matrix.os, 'windows' ) }} | |
run: | | |
VERSION=`grep '^VERSION' proton_driver/__init__.py \ | |
| sed 's/^VERSION = (//g' \ | |
| sed 's/).*//g' \ | |
| sed 's/, /./g'` | |
VERSION=v$VERSION | |
echo $VERSION | |
echo "tag_name=$VERSION" >> $GITHUB_OUTPUT | |
- name: Get proton-python-driver tag(windows) | |
if: ${{ startsWith( matrix.os, 'windows' ) }} | |
id: get_tag_name_win | |
shell: pwsh | |
run: | | |
$VERSION=((Get-Content proton_driver/__init__.py | Select-String -Pattern '^VERSION') -replace "^VERSION = \((\d+), (\d+), (\d+)\)","v`$1.`$2.`$3") | |
Write-Output $VERSION | |
Write-Output "tag_name=$VERSION" >> $env:GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
if: ${{ startsWith( matrix.os, 'ubuntu' ) }} | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
config-file: pyproject.toml | |
- name: Release wheels | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: wheelhouse/*.whl | |
generate_release_notes: true | |
tag_name: ${{ join(steps.*.outputs.tag_name, '') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: wheelhouse/*.whl | |
publish-to-pypi: | |
name: Publish Python distribution to PyPI | |
needs: | |
- build_wheels | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/proton-driver | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
username: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |