Skip to content

chore: add server client config #50

chore: add server client config

chore: add server client config #50

Workflow file for this run

name: Test And Release
on:
push:
branches: [ main ]
tags:
- "v*.*.*"
pull_request:
branches: [ main ]
jobs:
test:
name: Run Tests / OS ${{ matrix.os }} / Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }} --all-extras --dev
- name: Run Pre-commit
run: uvx pre-commit run --all-files
- name: Run linters
run: uv run bash scripts/lint.sh
release:
name: Bump Version and Release
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write # enable for OIDC [4,5]
contents: write
outputs:
version: ${{ steps.inspect_package.outputs.version }}
package: ${{ steps.inspect_package.outputs.package }}
environment:
name: pypi # display pypi in page
url: https://pypi.org/project/${{ steps.inspect_package.outputs.package }}/${{ steps.inspect_package.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install dependencies
run: uv sync --dev
# add trusted-publishers on pypi first[6]
- name: Build
run: uv build
- name: Inspect package version
id: inspect_package
run: |
version=$(uvx hatchling version)
echo "version=$version" >> "$GITHUB_OUTPUT"
package=$(uvx hatchling metadata | jq -r .name)
echo "package=$package" >> "$GITHUB_OUTPUT"
- name: Publish
run: uv publish
- name: Generate a changelog
env:
ATTICUS_PAT: ${{ secrets.ATTICUS_PAT }}
run: uv run git-cliff -vv --latest --strip header --github-token "$ATTICUS_PAT" -o CHANGES.md
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGES.md
token: ${{ secrets.GITHUB_TOKEN }}
# Reference
# 1. https://docs.astral.sh/uv/guides/integration/github/#syncing-and-running
# 2. /~https://github.com/Kludex/python-template/blob/main/.github/workflows/main.yml
# 3. /~https://github.com/softprops/action-gh-release/tree/master/
# 4. https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
# 5. https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-pypi
# 6. https://docs.pypi.org/trusted-publishers/adding-a-publisher/