Skip to content

Releasing

Releasing #209

Workflow file for this run

name: Build & Release
run-name: "Releasing"
on:
pull_request:
branches:
- main
types:
- closed
jobs:
generate-version:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version.outputs.version }}
steps:
- name: Github Checkout
# v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install hatch
run: |
pip install hatch
- name: Get Version
id: version
run: |
echo "version=$(hatch version)" >> $GITHUB_OUTPUT
publish:
runs-on: ubuntu-latest
needs:
- generate-version
permissions:
contents: write
steps:
- name: Github Checkout
# v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Release
# v1.14.0
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
with:
tag: ${{ needs.generate-version.outputs.new_version }}
generateReleaseNotes: true
draft: false
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install hatch
run: |
pip install hatch
- name: Build SDK
run: |
hatch build
- name: Publish Python 🐍 distributions 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
post-release:
name: Post Release Actions
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- generate-version
- publish
steps:
- name: Checkout main branch
uses: actions/[email protected]
with:
ref: main
- name: Slack - Success Message
uses: DSdatsme/slack-github-action@env_support
if: ${{ success() && needs.publish.result == 'success' }}
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
payload-file-path: ./.github/resources/slack-payloads/slack-message-template.json
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
RELEASETAG: ${{ needs.generate-version.outputs.new_version }}
PRE_TEXT_MESSAGE: "Workflow Passed! :successkid:"
FALLBACK_MESSAGE: "Workflow Passed!"
COLOR: "good"
- name: Slack - Failure Message
uses: DSdatsme/slack-github-action@env_support
if: ${{ failure() || needs.publish.result != 'success' }}
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
payload-file-path: ./.github/resources/slack-payloads/slack-message-template.json
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
RELEASETAG: ${{ needs.generate-version.outputs.new_version }}
PRE_TEXT_MESSAGE: "<!channel> Workflow Failed! :x:"
FALLBACK_MESSAGE: "Workflow Failed!"
COLOR: "danger"