Skip to content

Commit

Permalink
Update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nlgranger committed Aug 12, 2023
1 parent 74ef9f2 commit 96abc22
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/release.yml
@@ -1,16 +1,15 @@
name: Release
run-name: ${{ github.event.head_commit.message }}
run-name: Release ${{ github.ref_name }}

on:
push:
tags: v*
workflow_dispatch:

jobs:
build-wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
os: [ubuntu-22.04, windows-2022, macos-12]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -41,21 +40,35 @@ jobs:
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download dist
uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Store whether the current ref is on main
id: check-ref-on-main
run: |
git fetch --all --filter=tree:0
printf "ref_on_main=%s\n" \
$(git branch -a --contains ${{ github.ref_name }} --format "%(refname:short)" \
| grep "^origin/main$" &> /dev/null \
&& echo "true" \
|| echo "false" \
) \
>> $GITHUB_OUTPUT
- name: Upload to TestPyPi
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event.base_ref != 'refs/heads/master'
if: ${{ steps.check-ref-on-main.outputs.ref_on_main != 'true' }}
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/

- name: Upload to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event.base_ref == 'refs/heads/master'
if: ${{ steps.check-ref-on-main.outputs.ref_on_main == 'true' }}
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 96abc22

Please sign in to comment.