Skip to content

Commit

Permalink
chore: update release workflow to fix condition and concurrency group
Browse files Browse the repository at this point in the history
  • Loading branch information
mikita-sakalouski committed May 29, 2024
1 parent b18ddde commit d8c066c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 78 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/build_koheesio.yaml

This file was deleted.

61 changes: 52 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: release
name: release

on:
workflow_run:
workflows: [ "build koheesio" ]
types:
- completed
push:
tags:
- koheesio-v*
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.event.pull_request.number || github.sha }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

defaults:
Expand All @@ -21,11 +22,53 @@ env:
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.workflow_run.conclusion == 'success' }}
# FIXME: This is not working as expected
# && github.event.workflow_run.event == 'push' && startsWith(github.event.workflow_run.event.ref, 'refs/tags')
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest

steps:
Expand Down

0 comments on commit d8c066c

Please sign in to comment.