This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-06 00:21:38 -05:00
1 parent 11f5292d48
commit fba47a2191
2 files changed
+81

No files matched your search

+49
View File
@@ -14,6 +14,9 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
version: ${{ steps.pkg.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -69,6 +72,20 @@ jobs:
if: steps.check.outputs.skip != 'true'
run: python -m build --wheel
- name: Build Linux wheelhouse
if: steps.check.outputs.skip != 'true'
run: |
VERSION="${{ steps.pkg.outputs.version }}"
WHEEL="dist/cptr-${VERSION}-py3-none-any.whl"
mkdir -p wheelhouse
python -m pip download --dest wheelhouse "${WHEEL}[all]"
tar -czf "cptr-${VERSION}-linux-wheelhouse.tar.gz" -C wheelhouse .
- name: Generate checksums
if: steps.check.outputs.skip != 'true'
run: |
sha256sum dist/*.whl cptr-*-linux-wheelhouse.tar.gz > SHA256SUMS
- name: Upload dist artifacts
if: steps.check.outputs.skip != 'true'
uses: actions/upload-artifact@v4
@@ -76,12 +93,23 @@ jobs:
name: dist
path: dist/
- name: Upload release artifacts
if: steps.check.outputs.skip != 'true'
uses: actions/upload-artifact@v4
with:
name: release-assets
path: |
dist/*.whl
cptr-*-linux-wheelhouse.tar.gz
SHA256SUMS
publish:
needs: build
if: needs.build.outputs.skip != 'true'
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: write
id-token: write
steps:
- name: Download dist artifacts
@@ -90,7 +118,28 @@ jobs:
name: dist
path: dist/
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
name: release-assets
path: release-assets/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# No API token needed - uses OIDC trusted publishing.
# Configure at: https://pypi.org/manage/project/cptr/settings/publishing/
- name: Upload GitHub release artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.build.outputs.version }}
run: |
for attempt in {1..12}; do
if gh release view "v${VERSION}" >/dev/null 2>&1; then
gh release upload "v${VERSION}" release-assets/* --clobber
exit 0
fi
sleep 10
done
echo "GitHub release v${VERSION} was not found" >&2
exit 1