Skip to content

Commit

Permalink
Merge pull request #13 from nvictus/pypi-release-action
Browse files Browse the repository at this point in the history
Conditional python release workflow
  • Loading branch information
jackh726 authored Jan 30, 2024
2 parents 0fa8071 + efd4cd0 commit a8e0499
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Build and publish Python package to PyPI

on:
release:
types: [created]
workflow_dispatch:

permissions:
contents: read

jobs:
sdist:
if: startsWith(github.ref, 'refs/tags/pybigtools@v')

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path pybigtools/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

linux:
if: startsWith(github.ref, 'refs/tags/pybigtools@v')

runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter --manifest-path pybigtools/Cargo.toml
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

windows:
if: startsWith(github.ref, 'refs/tags/pybigtools@v')

runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter --manifest-path pybigtools/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

macos:
if: startsWith(github.ref, 'refs/tags/pybigtools@v')

runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter --manifest-path pybigtools/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

publish:
if: startsWith(github.ref, 'refs/tags/pybigtools@v')

runs-on: ubuntu-latest
permissions:
id-token: write

needs: [linux, windows, macos, sdist]

steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
with:
command: upload
args: --skip-existing *
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Build and release binaries

on:
release:
types: [created]
workflow_dispatch:

jobs:
release:
if: startsWith(github.ref, 'refs/tags/v')

name: Build and Release
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -25,6 +30,7 @@ jobs:
target: x86_64-apple-darwin
asset_name: bigtools-apple-darwin
remote: true

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down

0 comments on commit a8e0499

Please sign in to comment.