| 1 |
--- |
| 2 |
name: Release |
| 3 |
|
| 4 |
# yamllint disable rule:line-length |
| 5 |
# yamllint disable-line rule:truthy |
| 6 |
on: |
| 7 |
release: |
| 8 |
types: |
| 9 |
- published |
| 10 |
|
| 11 |
env: |
| 12 |
DEFAULT_PYTHON: "3.12" |
| 13 |
|
| 14 |
jobs: |
| 15 |
release: |
| 16 |
name: Releasing to PyPi |
| 17 |
runs-on: ubuntu-latest |
| 18 |
environment: release |
| 19 |
permissions: |
| 20 |
id-token: write |
| 21 |
steps: |
| 22 |
- name: โคต๏ธ Check out code from GitHub |
| 23 |
uses: actions/[email protected] |
| 24 |
- name: ๐ Set up Poetry |
| 25 |
run: pipx install poetry |
| 26 |
- name: ๐ Set up Python ${{ env.DEFAULT_PYTHON }} |
| 27 |
id: python |
| 28 |
uses: actions/[email protected] |
| 29 |
with: |
| 30 |
python-version: ${{ env.DEFAULT_PYTHON }} |
| 31 |
cache: "poetry" |
| 32 |
- name: ๐ Install workflow dependencies |
| 33 |
run: | |
| 34 |
poetry config virtualenvs.create true |
| 35 |
poetry config virtualenvs.in-project true |
| 36 |
- name: ๐ Install dependencies |
| 37 |
run: poetry install --no-interaction |
| 38 |
- name: ๐ Set package version |
| 39 |
run: | |
| 40 |
version="${{ github.event.release.tag_name }}" |
| 41 |
version="${version,,}" |
| 42 |
version="${version#v}" |
| 43 |
poetry version --no-interaction "${version}" |
| 44 |
- name: ๐ Build package |
| 45 |
run: poetry build --no-interaction |
| 46 |
- name: ๐ Publish package to PyPi |
| 47 |
uses: pypa/[email protected] |