Skip to content

Commit f7750b9

Browse files
ci(package-publishing-script): update package publishing script (#9)
This commit bears the change in the script used for pypi package publishing. The improvements made in this commit is that job will use the production environment and will create the tags and changelogs automatically. closes #7
1 parent e4dd329 commit f7750b9

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
name: Publish Package
22

33
on:
4-
workflow_dispatch
4+
workflow_dispatch:
5+
inputs:
6+
Version:
7+
description: "Version to be released in format: x.y.z, where x => major version, y => minor version and z => patch version"
8+
required: true
9+
default: "0.1.0"
10+
Title:
11+
description: "Title of the release"
12+
required: true
13+
default: "Improving API developer experience"
514

615
jobs:
716
publish-package:
17+
environment: Production
818
runs-on: ubuntu-latest
19+
permissions:
20+
packages: write
21+
contents: write
922
steps:
1023
- uses: actions/checkout@v3
1124
- name: Set up Python
@@ -18,6 +31,22 @@ jobs:
1831
python -m build
1932
twine check --strict dist/*
2033
- name: Publish distribution to PyPI
34+
id: release
2135
uses: pypa/gh-action-pypi-publish@v1.5.1
2236
with:
2337
password: ${{ secrets.PYPI_TOKEN }}
38+
- name: Create tag
39+
if: steps.release.outputs.exit_code == 0
40+
id: tag_version
41+
uses: mathieudutour/github-tag-action@v6.0
42+
with:
43+
github_token: ${{ secrets.TAGS_TOKEN }}
44+
custom_tag: ${{ github.event.inputs.Version }}
45+
tag_prefix: ""
46+
- name: Create changelog for the release
47+
if: steps.release.outputs.exit_code == 0
48+
uses: ncipollo/release-action@v1
49+
with:
50+
tag: ${{ steps.tag_version.outputs.new_tag }}
51+
name: Release ${{ github.event.inputs.Title }}
52+
body: ${{ steps.tag_version.outputs.changelog }}

0 commit comments

Comments
 (0)