Skip to content

update

update #69

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
push:
branches:
- main
release:
types: [published]
permissions:
contents: read
jobs:
deploy-linux:
name: Build wheels for Linux
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for PyPI trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
# ATTENTION: set CIBW_ENVIRONMENT=GITLAB_AUTH=username:token in your repository secrets
- name: Build wheels
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/cibuildwheel@v2.19.2
# ATTENTION: this step is mandatory for PyPI trusted publishing
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/
deploy-macos: # WITHOUT testing
name: Build wheels for macOS
runs-on: macos-latest
permissions:
# IMPORTANT: this permission is mandatory for PyPI trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
# ATTENTION: set CIBW_ENVIRONMENT=GITLAB_AUTH=username:token in your repository secrets
- name: Build wheels
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/cibuildwheel@v2.19.2
# ATTENTION: this step is mandatory for PyPI trusted publishing
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/
publish:
needs: [deploy-linux, deploy-macos]
runs-on: ubuntu-latest # 仅在 Linux 环境中运行
permissions:
id-token: write
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse/
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: wheelhouse/