-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): add workflow to push releases to PyPI (#23)
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Release and Publish | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
tags: [ '[0-9]+.[0-9]+.[0-9]+' ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository == 'ibis-project/ibisml' }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- name: Install build dependencies | ||
run: | | ||
python -m pip install build --user | ||
- name: Build package | ||
run: | | ||
python -m build | ||
- name: Upload package | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
retention-days: 1 | ||
release: | ||
name: Release to GitHub | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
- name: Publish to GitHub release page | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./dist/*.whl | ||
./dist/*.tar.gz | ||
publish: | ||
name: Publish to PyPI | ||
runs-on: ubuntu-latest | ||
needs: release | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |