Publish 0.1.1 to PyPI #3
Workflow file for this run
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 | |
run-name: Publish ${{ github.event.release.tag_name }} to PyPI | |
on: | |
release: | |
types: [released] | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "poetry" | |
- name: Install dependencies | |
run: | | |
poetry env use "3.12" | |
poetry install | |
- name: Bump version number | |
run: poetry version ${{ github.event.release.tag_name }} | |
- name: Build package | |
run: poetry build | |
- name: Publish to prod pypi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
determine-success: | |
if: always() | |
needs: | |
- build-and-publish | |
runs-on: ubuntu-latest | |
outputs: | |
success: ${{ steps.success.outputs.success }} | |
steps: | |
- id: success | |
run: | | |
if [[ "${{ needs.build-and-publish.result }}" == "success" ]]; then | |
echo "success=true" >> $GITHUB_OUTPUT | |
else | |
echo "success=false" >> $GITHUB_OUTPUT | |
fi | |
notify-slack: | |
if: always() | |
uses: i-dot-ai/i-dot-ai-core-github-actions/.github/workflows/slack-notify.yml@main | |
needs: | |
- build-and-publish | |
- determine-success | |
with: | |
WORKFLOW_PASSED: ${{ needs.determine-success.outputs.success == 'true' }} | |
SUCCESS_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":airplane: ${{ github.repository }} - Successfully deployed ${{ github.event.release.tag_name }}:large_green_circle:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Package published to PyPI successfully\"}}]}" | |
FAILURE_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":x: ${{ github.repository }} - Failed to deploy ${{ github.event.release.tag_name }} :x:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Failed to publish package to PyPI\"}}]}" | |
secrets: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |