-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
deb80f4
commit 3afa5e9
Showing
2 changed files
with
74 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,62 @@ | ||
# This workflow will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#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: Release Package | ||
name: Publish to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
pull_request: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release-tag: | ||
name: 'Tagged Release' | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- name: Create a new GitHub release | ||
uses: 'marvinpinto/action-automatic-releases@latest' | ||
with: | ||
repo_token: '${{ secrets.GITHUB_TOKEN }}' | ||
prerelease: false | ||
|
||
release-to-pypi: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
build: | ||
name: > | ||
build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }} | ||
${{ (matrix.arch) || '' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu, windows, macos] | ||
python-version: ['cp312', 'cp311'] | ||
|
||
runs-on: ${{ matrix.os }}-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- uses: pypa/cibuildwheel@v2.17.0 | ||
env: | ||
CIBW_BUILD: '${{ matrix.python-version }}-*' | ||
CIBW_ARCHS: ${{ matrix.arch || 'auto' }} | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-${{ matrix.os }}-${{ matrix.python-version }} | ||
path: ./wheelhouse/*.whl | ||
|
||
upload: | ||
name: Upload wheels to PYPI | ||
runs-on: ubuntu-latest | ||
if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch') | ||
needs: [build_wheels, build_sdist] | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/pyforc | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Retrieve wheels and sdist | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: wheels-* | ||
merge-multiple: true | ||
path: wheels/ | ||
|
||
- name: List all built wheels | ||
run: | | ||
ls -lAs wheels/ | ||
- name: Upload to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1.8 | ||
with: | ||
packages_dir: wheels/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters