-
Notifications
You must be signed in to change notification settings - Fork 362
87 lines (81 loc) · 2.08 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CD
on:
workflow_dispatch:
inputs:
dry-run:
type: boolean
description: "Dry-run"
required: true
default: true
version:
description: "SemVer string for new version"
required: true
jobs:
build:
runs-on: ubuntu-latest
environment:
name: protected
steps:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Build Python packages
uses: hynek/build-and-inspect-python-package@v2
tag:
runs-on: ubuntu-latest
environment:
name: protected
permissions:
contents: write
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Tag new version
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ github.token }}
default_bump: "false"
custom_tag: ${{ inputs.version }}
tag_prefix: ""
dry_run: ${{ inputs.dry-run }}
release:
needs:
- build
- tag
runs-on: ubuntu-latest
environment:
name: protected
permissions:
contents: write
steps:
- name: Download built Python packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Create GitHub Release with Python packages
uses: ncipollo/release-action@v1
with:
artifacts: dist/*
tag: ${{ needs.tag.outputs.new_tag }}
generateReleaseNotes: true
draft: ${{ inputs.dry-run }}
publish:
needs: release
runs-on: ubuntu-latest
if: ${{ ! inputs.dry-run }}
environment:
name: publish
permissions:
id-token: write
steps:
- name: Download built Python package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1