-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (46 loc) · 1.43 KB
/
release.yml
File metadata and controls
56 lines (46 loc) · 1.43 KB
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
48
49
50
51
52
53
54
55
56
name: Release
on:
pull_request:
push:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: poetry
cache-dependency-path: pyproject.toml
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Install dependencies
run: poetry install
- name: Build sdist
run: |
rm -rf dist # just in case
poetry run invoke build --sdist --wheel
- name: Check Tag # SemVer + PEP 440, e.g., 1.0.0rc1.post1
id: check-tag
run: |
if [[ ${{ github.ref }} =~ ^refs\/tags\/[0-9]+\.[0-9]+\.[0-9]+(a[0-9]+|b[0-9]+|rc[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$ ]]; then
echo 'match=true' >>$GITHUB_OUTPUT
fi
- name: Publish to PyPI
if: steps.check-tag.outputs.match == 'true'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --no-interaction
- name: Publish to PyPI (dry-run)
if: steps.check-tag.outputs.match != 'true'
run: poetry publish --no-interaction --dry-run