Skip to content

v0.6.1 — v0.6.0 publish 회복 + 후속 polish (PATCH) #11

v0.6.1 — v0.6.0 publish 회복 + 후속 polish (PATCH)

v0.6.1 — v0.6.0 publish 회복 + 후속 polish (PATCH) #11

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [published]
# 수동 트리거 시 wheel 빌드만 검증하고 실제 업로드는 skip (dry-run)
workflow_dispatch: {}
permissions:
contents: read
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
jobs:
verify-version:
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check Cargo.toml version matches release tag
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION=$(python -c "
import re
with open('Cargo.toml') as f:
match = re.search(r'^version\s*=\s*\"(.+?)\"', f.read(), re.MULTILINE)
print(match.group(1))
")
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "ERROR: Tag version ($TAG_VERSION) != Cargo.toml version ($PKG_VERSION)"
exit 1
fi
echo "Version check passed: $TAG_VERSION"
build-linux:
name: Build Linux wheel (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
command: build
args: --release --out dist
- uses: actions/upload-artifact@v7
with:
name: wheels-linux-${{ matrix.target }}
path: dist/*.whl
build-macos:
name: Build macOS wheel (${{ matrix.target }})
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
command: build
args: --release --out dist
- uses: actions/upload-artifact@v7
with:
name: wheels-macos-${{ matrix.target }}
path: dist/*.whl
build-windows:
name: Build Windows wheel
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist
- uses: actions/upload-artifact@v7
with:
name: wheels-windows
path: dist/*.whl
sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
publish:
# 실 PyPI 업로드는 release 이벤트일 때만. workflow_dispatch 에서는 skip (dry-run).
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [verify-version, build-linux, build-macos, build-windows, sdist]
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1