-
Notifications
You must be signed in to change notification settings - Fork 14
47 lines (45 loc) · 1.63 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Workflow created according to: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish to PyPI and TestPyPI
on:
push:
tags: ["v*"]
release:
types: ["published"]
jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.11"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install poetry dynamic versioning plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"
- name: Build package
run: poetry build
- if: github.event_name == 'release'
name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- if: github.event_name != 'release'
name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/