Skip to content

PyPI Publish

PyPI Publish #76

Workflow file for this run

name: PyPI Publish
on:
release:
types: [created]
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: "Build PyPI Package"
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/cache
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Build
run: |
python -m pip install pipx
pipx run cibuildwheel
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels_${{ github.event.release.tag_name }}_${{ matrix.os }}
retention-days: 1
path: ./wheelhouse/*.whl
publish:
name: "Publish PyPI Package"
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels_${{ github.event.release.tag_name }}_*
merge-multiple: true
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Publish PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
ls
twine upload *
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/cache
- name: Publish Crates
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
run: |
python setup.py sdist
twine upload --skip-existing dist/*
cargo login $CRATES_TOKEN
cargo publish
image:
name: "Build Docker Image"
runs-on: ubuntu-latest
needs: [publish]
steps:
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: actions/checkout@v4
- name: Build and push image
uses: docker/build-push-action@v5
with:
push: true
tags: mosecorg/mosec:${{ github.event.release.tag_name }}
file: Dockerfile
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max