66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
name: Build And Publish Package
|
|
run-name: ${{ github.actor }} builds and publishes package to PyPI
|
|
on:
|
|
push:
|
|
branches:
|
|
- latest
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Cache uv binary
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ github.workspace }}/uv
|
|
key: uv-${{ runner.os }}
|
|
restore-keys: uv-${{ runner.os }}
|
|
|
|
- name: Cache uv dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ github.workspace }}/.cache/uv
|
|
key: uv-${{ runner.os }}
|
|
restore-keys: uv-${{ runner.os }}
|
|
|
|
- name: Cache pre-commit
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pre-commit
|
|
key: pre-commit-cache-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
restore-keys: pre-commit-cache-${{ runner.os }}-
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
version: "0.7.8"
|
|
enable-cache: true
|
|
cache-local-path: ${{ github.workspace }}/.cache/uv
|
|
tool-dir: ${{ github.workspace }}/.cache/uv
|
|
tool-bin-dir: ${{ github.workspace }}/.cache/uv
|
|
cache-dependency-glob: ""
|
|
|
|
- name: Set up Python
|
|
run: uv python install
|
|
|
|
- name: Install the project
|
|
run: uv sync --all-extras --no-install-project --cache-dir ${{ github.workspace }}/.cache/uv
|
|
|
|
- name: Linter & Formatter
|
|
run: uv run pre-commit run --all-files
|
|
|
|
- name: Build Package
|
|
run: uv build --cache-dir ${{ github.workspace }}/.cache/uv
|
|
|
|
- name: Publish to Gitea PyPI
|
|
run: |
|
|
uv publish \
|
|
--index aiohttpx \
|
|
--username ${{ secrets.CI_USERNAME }} \
|
|
--token ${{ secrets.CI_TOKEN }}
|