Skip to content

Merge pull request #272 from Haidra-Org/main #54

Merge pull request #272 from Haidra-Org/main

Merge pull request #272 from Haidra-Org/main #54

Workflow file for this run

name: horde_sdk build and publish
on:
push:
branches:
- releases
jobs:
build-n-publish:
name: horde_sdk build and publish
runs-on: ubuntu-latest
environment: # see https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/
name: pypi
url: https://pypi.org/p/horde-sdk/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write
pull-requests: read
steps:
- name: "📣 Release on push"
id: release
uses: rymndhng/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bump_version_scheme: patch
use_github_release_notes: true
- name: "✔️ Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
# Pass the version number in an env var to the below steps
- name: Set build version env var
run: echo "SETUPTOOLS_SCM_PRETEND_VERSION=${{ steps.release.outputs.version }}" >> $GITHUB_ENV
# We need python...
- name: "🐍 Set up Python 3.10"
if: ${{ steps.release.outputs.version != '' }}
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Install build deps
- name: "🛠 Install pypa/build"
if: ${{ steps.release.outputs.version != '' }}
run: |
python -m pip install --upgrade pip
python -m pip install build
# Build a pypi distribution using the env var version number
- name: "🔧 Build a binary wheel and a source tarball"
if: ${{ steps.release.outputs.version != '' }}
run: >-
python -m build --sdist --wheel --outdir dist/ .
# # Publish the package
- name: "📦 Publish distribution to PyPI"
if: ${{ steps.release.outputs.version != '' }}
uses: pypa/gh-action-pypi-publish@release/v1
# # Update the badges (maybe, if we're lucky)
# - name: "📦 Refresh pypi badge cache"
# run: >-
# curl -X PURGE
# url_here
# - name: "📦 Refresh downloads badge cache"
# run: >-
# curl -X PURGE
# url_here
# - name: "Inform with Discord Webhook"
# if: ${{ steps.release.outputs.version != '' }}
# uses: tsickert/[email protected]
# with:
# webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
# content: "New version of horde_sdk has been published to pypi: ${{ steps.release.outputs.version }}."