Release PyPI Package #5
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
name: Release PyPI Package | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
# build and publish steps should be separate for security reasons. | |
# see: https://docs.pypi.org/trusted-publishers/security-model/ | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Poetry | |
run: python -m pip install poetry --user | |
- name: Build project | |
run: python -m poetry build | |
- name: Store build output | |
uses: actions/upload-artifact@v3 | |
id: build-upload | |
with: | |
name: bw-merge-window-dist | |
path: dist | |
retention-days: 1 | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: release | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: bw-merge-window-dist | |
- name: Build and publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |