From 4c6d8f3b50d613c1a20fe583d6096a0ece2eaaf0 Mon Sep 17 00:00:00 2001 From: Nezar Abdennur Date: Mon, 29 Jan 2024 13:42:39 -0500 Subject: [PATCH 1/3] Add conditional python release workflow --- .github/workflows/release-python.yml | 120 +++++++++++++++++++++++++++ .github/workflows/release.yml | 3 + 2 files changed, 123 insertions(+) create mode 100644 .github/workflows/release-python.yml diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml new file mode 100644 index 0000000..2a8bb1a --- /dev/null +++ b/.github/workflows/release-python.yml @@ -0,0 +1,120 @@ +name: Publish Python Package to PyPI + +on: + release: + types: [created] + workflow_dispatch: + +permissions: + contents: read + +jobs: + 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 py-oxbow/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@') + + 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 py-oxbow/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@') + + 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 py-oxbow/Cargo.toml + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + sdist: + if: startsWith(github.ref, 'refs/tags/pybigtools@') + + 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 py-oxbow/Cargo.toml + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + publish: + if: startsWith(github.ref, 'refs/tags/pybigtools@') + + 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 * diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 051c0fd..e5ce968 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,8 @@ on: jobs: release: + if: startsWith(github.ref, 'refs/tags/v') + name: Build and Release runs-on: ${{ matrix.os }} strategy: @@ -25,6 +27,7 @@ jobs: target: x86_64-apple-darwin asset_name: bigtools-apple-darwin remote: true + steps: - name: Checkout code uses: actions/checkout@v2 From b88bd35cc4d377b9a8900d145e1d06f3dcaa3855 Mon Sep 17 00:00:00 2001 From: Nezar Abdennur Date: Mon, 29 Jan 2024 17:04:31 -0500 Subject: [PATCH 2/3] Fix manifest path --- .github/workflows/release-python.yml | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 2a8bb1a..9e7e731 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -9,6 +9,23 @@ permissions: contents: read jobs: + sdist: + if: startsWith(github.ref, 'refs/tags/pybigtools@') + + 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') @@ -25,7 +42,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --manifest-path py-oxbow/Cargo.toml + args: --release --out dist --find-interpreter --manifest-path pybigtools/Cargo.toml sccache: 'true' manylinux: auto - name: Upload wheels @@ -51,7 +68,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --manifest-path py-oxbow/Cargo.toml + args: --release --out dist --find-interpreter --manifest-path pybigtools/Cargo.toml sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v3 @@ -75,30 +92,13 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --manifest-path py-oxbow/Cargo.toml + 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 - - sdist: - if: startsWith(github.ref, 'refs/tags/pybigtools@') - - 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 py-oxbow/Cargo.toml - - name: Upload sdist - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist publish: if: startsWith(github.ref, 'refs/tags/pybigtools@') From efd4cd00eafd3e8d9958c34284405ccbb2bf8c47 Mon Sep 17 00:00:00 2001 From: Nezar Abdennur Date: Mon, 29 Jan 2024 17:34:15 -0500 Subject: [PATCH 3/3] Update workflows --- .github/workflows/release-python.yml | 10 +++++----- .github/workflows/release.yml | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 9e7e731..acc47ea 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -1,4 +1,4 @@ -name: Publish Python Package to PyPI +name: Build and publish Python package to PyPI on: release: @@ -10,7 +10,7 @@ permissions: jobs: sdist: - if: startsWith(github.ref, 'refs/tags/pybigtools@') + if: startsWith(github.ref, 'refs/tags/pybigtools@v') runs-on: ubuntu-latest steps: @@ -52,7 +52,7 @@ jobs: path: dist windows: - if: startsWith(github.ref, 'refs/tags/pybigtools@') + if: startsWith(github.ref, 'refs/tags/pybigtools@v') runs-on: windows-latest strategy: @@ -77,7 +77,7 @@ jobs: path: dist macos: - if: startsWith(github.ref, 'refs/tags/pybigtools@') + if: startsWith(github.ref, 'refs/tags/pybigtools@v') runs-on: macos-latest strategy: @@ -101,7 +101,7 @@ jobs: path: dist publish: - if: startsWith(github.ref, 'refs/tags/pybigtools@') + if: startsWith(github.ref, 'refs/tags/pybigtools@v') runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5ce968..1a6718c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,9 @@ +name: Build and release binaries + on: release: types: [created] + workflow_dispatch: jobs: release: