Skip to content

Commit

Permalink
considering auto incrementing version
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Aug 9, 2024
1 parent c2f5a73 commit 2591183
Showing 1 changed file with 55 additions and 34 deletions.
89 changes: 55 additions & 34 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,71 @@ name: Publish Python Package

on:
workflow_dispatch:
push:
release:
types:
- published

jobs:
build_sdist:
name: Build
determine_version:
name: Determine Next Dev Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Build SDist and Wheel
run: pipx run build --sdist --wheel
- name: Determine next dev version
id: dev_version
run: |
current_version=$(grep '__version__' src/acom_music_box/__init__.py | awk -F'"' '{print $2}')
if [[ "$current_version" == *".dev"* ]]; then
base_version=$(echo $current_version | sed 's/\.dev[0-9]*//')
dev_number=$(echo $current_version | grep -oP '\.dev\K[0-9]+')
next_dev_version="$base_version.dev$((dev_number+1))"
else
next_dev_version="$current_version.dev1"
fi
echo "Next dev version: $next_dev_version"
echo "next_dev_version=$next_dev_version" >> $GITHUB_ENV
- name: Check metadata
run: pipx run twine check dist/*
# build_sdist:
# name: Build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*
# - name: Build SDist and Wheel
# run: pipx run build --sdist --wheel

upload_all:
name: Upload release
needs: [build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/acom_music_box
permissions:
id-token: write
# - name: Check metadata
# run: pipx run twine check dist/*

steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# - uses: actions/upload-artifact@v4
# with:
# name: cibw-sdist
# path: dist/*

# upload_all:
# name: Upload release
# needs: [build_sdist]
# runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/p/acom_music_box
# permissions:
# id-token: write

# steps:
# - uses: actions/setup-python@v5
# with:
# python-version: "3.x"

# - uses: actions/download-artifact@v4
# with:
# pattern: cibw-*
# path: dist
# merge-multiple: true

# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 2591183

Please sign in to comment.