-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from flairNLP/pypi-release-workflow
Add release workflow to automatically publish on PyPi
- Loading branch information
Showing
3 changed files
with
125 additions
and
4 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: [ master ] | ||
pull_request: | ||
workflow_call: | ||
|
||
jobs: | ||
black: | ||
|
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,123 @@ | ||
# This release workflow was created using the following guide | ||
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | ||
|
||
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
|
||
test: | ||
name: Test the latest release commit | ||
uses: ./.github/workflows/tests.yml | ||
|
||
lint: | ||
name: Lint the latest release commit | ||
uses: ./.github/workflows/lint.yml | ||
|
||
build: | ||
name: Build distribution 📦 | ||
needs: | ||
- test | ||
- lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install pypa/build | ||
run: >- | ||
python3 -m | ||
pip install | ||
build | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: python3 -m build | ||
|
||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-testpypi: | ||
name: Publish Python 🐍 distribution 📦 to TestPyPI | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/fundus | ||
|
||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish distribution 📦 to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
- name: Sleep for 2 minutes | ||
run: sleep 2m | ||
shell: bash | ||
|
||
test-distribution: | ||
name: Install and test TestPyPi distribution | ||
needs: | ||
- publish-to-testpypi | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install package | ||
run: >- | ||
python3 -m | ||
pip install | ||
--index-url https://test.pypi.org/simple/ | ||
--extra-index-url https://pypi.org/simple/ | ||
fundus==${{ github.event.release.tag_name }} | ||
publish-to-pypi: | ||
name: Publish Python 🐍 distribution 📦 to PyPI | ||
needs: | ||
- test-distribution | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/fundus | ||
|
||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
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