-
Notifications
You must be signed in to change notification settings - Fork 9
29 lines (29 loc) · 1.07 KB
/
publish.yml
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
name: Publish to PyPI
on:
release:
types: [published]
jobs:
pypi_release:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/logdetective
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
# Regex by https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
- name: Check semver
run: >
echo "${{ github.ref }}" | grep -q -P "^refs/tags/v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
|| exit 1
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python -
- name: Add Poetry to path
run: echo "${HOME}/.poetry/bin" >> $GITHUB_PATH
- run: poetry install
- name: Build package
run: poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1