Publishing Package Version 0.2.18 #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |