Skip to content

chore: update release workflow to fix condition and concurrency group #13

chore: update release workflow to fix condition and concurrency group

chore: update release workflow to fix condition and concurrency group #13

Workflow file for this run

name: release
on:
push:
tags:
- koheesio-v*
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
APP_NAME: koheesio
PYTHON_VERSION: "3.12"
PYOXIDIZER_VERSION: "0.24.0"
DIST_URL: "https://github.com/Nike-Inc/koheesio/releases"
jobs:
python-artifacts:
name: Build wheel and source distribution
runs-on: ubuntu-latest
outputs:
old-version: ${{ steps.version.outputs.old-version }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Hatch
uses: pypa/hatch@install
# Windows installers don't accept non-integer versions so we ubiquitously
# perform the following transformation: X.Y.Z.devN -> X.Y.Z.N
- name: Set project version
id: version
run: |-
old_version="$(hatch version)"
version="${old_version/dev/}"
echo "old-version=$old_version" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
echo "$version"
- name: Build
run: hatch build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-artifacts
path: dist/*
if-no-files-found: error
publish-pypi:
name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: dist
- name: Publish package to PyPI
uses: pypa/[email protected]
with:
print-hash: true