Skip to content

Commit

Permalink
chore(release): add workflow to push releases to PyPI (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth authored Feb 27, 2024
1 parent 083496d commit 8739bd6
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
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 }}

0 comments on commit 8739bd6

Please sign in to comment.