-
Notifications
You must be signed in to change notification settings - Fork 5
96 lines (82 loc) · 2.28 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Publish
on:
push:
tags:
- '*.*.*'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
env:
PY_COLORS: 1
PYTHON_VERSION: '3.12.6'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
- name: Install poetry dependencies
run: poetry install --no-root --with=dev --with=test
- name: Add Dynamic Versioning Plugin
run: |
poetry self add poetry-dynamic-versioning[plugin]
- name: Update the version
run: |
poetry dynamic-versioning
echo "VERSION=$(poetry version --short)"
- name: Package project
run: make twine-check
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
# [1-build-publish-workflow]
pypi-publish:
name: Publish release artifacts to PyPI
if: contains(github.ref, 'rc') == false
runs-on: ubuntu-22.04
needs:
- build
environment:
name: pypi
url: https://pypi.org/p/python_secrets
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
test-pypi-publish:
name: Publish release candidate artifacts to test PyPI
if: contains(github.ref, 'rc') == true
runs-on: ubuntu-22.04
needs:
- build
environment:
name: pypi
url: https://test.pypi.org/p/python_secrets
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish release candidate distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
# ![1-build-publish-workflow]