Skip to content

refactor: change private attr and step getter (#82) #54

refactor: change private attr and step getter (#82)

refactor: change private attr and step getter (#82) #54

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
needs: python-artifacts
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: python-artifacts
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1