-
Notifications
You must be signed in to change notification settings - Fork 2
61 lines (54 loc) · 1.86 KB
/
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
name: Publish Package
run-name: Publishing Package Version ${{ github.event.inputs.Version }}
on:
workflow_dispatch:
inputs:
Version:
description: "This input field requires version in format: x.y.z, where x => major version, y => minor version and z => patch version"
required: true
jobs:
publish-package:
environment: Production
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Build source and wheel distributions
run: |
python -m pip install --upgrade build twine
python -m build
twine check --strict dist/*
- name: Publish distribution to PyPI
id: release
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_TOKEN }}
- name: Create tag
if: steps.release.outputs.exit_code == 0
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.TAGS_TOKEN }}
custom_tag: ${{ github.event.inputs.Version }}
tag_prefix: ""
- name: Create changelog for the release
if: steps.release.outputs.exit_code == 0
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release Version ${{ github.event.inputs.Version }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Send slack notification
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'C012YFE3D6D'
slack-message: "core-lib-python release has been triggered!"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}