Skip to content

ci: replace old project name in github workflow #12

ci: replace old project name in github workflow

ci: replace old project name in github workflow #12

---
name: Test & Release
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
jobs:
validate:
name: "tests & coverage"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install hatch
- run: hatch fmt --check
- run: hatch test
- run: hatch run types:check
release:
name: "publish to GitHub and PyPi"
runs-on: ubuntu-latest
concurrency: release
environment:
name: release
url: https://pypi.org/p/alpax
if: github.event_name == 'push'
# Make sure tests pass before running.
needs:
- validate
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.12
# Publishing steps adapted from
# https://python-semantic-release.readthedocs.io/en/latest/migrating_from_v7.html#removal-of-pypi-token-repository-username-and-repository-password-inputs.
- name: Update package version if needed
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Authentication happens via OIDC. This specific workflow and
# environment needs to be trusted in the "Publishing" settings
# for the package on PyPi.
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'