Skip to content

feat(ci): build for Python >= 3.10 #3

feat(ci): build for Python >= 3.10

feat(ci): build for Python >= 3.10 #3

Workflow file for this run

name: Publish release
on:
workflow_dispatch:
push:
tags:
- "202[3-9].0[1-9].[1-9]" # 2023.02.2
- "202[3-9].0[1-9].[1-9]-rc[0-9]+" # 2023.02.2-rc1
- "202[3-9].0[1-9].[1-9][0-9]" # 2023.02.22
- "202[3-9].0[1-9].[1-9][0-9]-rc[0-9]+" # 2023.02.22-rc1
- "202[3-9].1[0-2].[1-9]" # 2023.11.1
- "202[3-9].1[0-2].[1-9]-rc[0-9]+" # 2023.11.1-rc1
- "202[3-9].1[0-2].[1-9][0-9]" # 2023.11.11
- "202[3-9].1[0-2].[1-9][0-9]-rc[0-9]+" # 2023.11.11-rc1
defaults:
run:
shell: bash
jobs:
test:
uses: ./.github/workflows/pytest.yml
package:
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.version }}
cache: pip
cache-dependency-path: "**/pyproject.toml"
- name: Install build dependencies
run: pip install build
- name: Build artifact for ${{ matrix.version }}
run: python -m build
- name: Upload artifact for ${{ matrix.version }}
uses: actions/upload-artifact@v3
with:
name: dist
path: ./dist/**
release:
runs-on: ubuntu-latest
environment: release
needs: package
permissions:
# https://github.com/softprops/action-gh-release#permissions
contents: write
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: ./dist
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./dist/*.tar.gz
./dist/*.whl
prerelease: ${{ contains(github.ref, '-rc') }}
generate_release_notes: ${{ !contains(github.ref, '-rc') }}
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1.5
if: ${{ contains(github.ref, '-rc') }}
with:
repository_url: https://test.pypi.org/legacy/
print_hash: true
skip_existing: true
verbose: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.5
if: ${{ !contains(github.ref, '-rc') }}
with:
print_hash: true