-
Notifications
You must be signed in to change notification settings - Fork 8
64 lines (52 loc) · 1.35 KB
/
cicd-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
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
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
branches:
- main
defaults:
run:
shell: bash
jobs:
python-artifacts:
name: Job to build wheel and source distribution files
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build frontend
run: pip install hatch
- name: Create packages in dist/ with hatch
run: hatch build
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: python-artifacts
path: dist/*
if-no-files-found: error
pypi-publish:
name: Upload release to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs:
- python-artifacts
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
environment:
name: pypi
url: https://pypi.org/p/ciscoconfparse2
steps:
- name: Retrieve package artifacts from build job
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: dist
- name: Upload packages to PYPI
uses: pypa/[email protected]