-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (55 loc) · 1.78 KB
/
cd.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
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
57
58
59
60
61
62
63
64
65
66
67
68
---
name: Release
env:
ENABLE_PYPI_PUBLISH: true
ENABLE_TEST_PYPI_PUBLISH: true
RELEASE_PYTHON_VERSION: "3.12"
RELEASE_POETRY_VERSION: "2.0"
on:
push:
tags:
- '*'
jobs:
Publish:
name: Publish package for ${{ github.ref_name }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/Cookiecutter template for new Python projects
permissions:
id-token: write
steps:
- name: 💾 Check out repository
uses: actions/checkout@v4
- name: 📜 Fetch full repository history for unit tests
run: git fetch --unshallow
- name: 🐍 Set up Python project with Poetry
uses: ./.github/workflows/actions/python-poetry
with:
python_version: ${{ env.RELEASE_PYTHON_VERSION }}
poetry_version: ${{ env.RELEASE_POETRY_VERSION }}
- name: 🔥 Test
run: poetry run poe test
- name: 🚒 Create test summary
uses: test-summary/action@v1
if: success() || failure()
with:
paths: ./.pytest_results.xml
- name: 📦 Build package
if: |
env.ENABLE_PYPI_PUBLISH == 'true'
|| env.ENABLE_TEST_PYPI_PUBLISH == 'true'
run: poetry build
- name: 🔼 Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ env.ENABLE_TEST_PYPI_PUBLISH == 'true' }}
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: ☢️ Publish to PyPI
if: ${{ env.ENABLE_PYPI_PUBLISH == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false