use uv to build pip package in github actions instead of pdm

This commit is contained in:
Nick Sweeting 2024-12-18 18:38:25 -08:00
parent b78e892bf8
commit e862031981
No known key found for this signature in database

View file

@ -3,76 +3,58 @@ name: Build Pip package
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches:
- '**'
tags:
- 'v*'
env:
PYTHON_VERSION: 3.11
jobs: jobs:
build: build:
runs-on: ubuntu-22.04
permissions: permissions:
id-token: write id-token: write
runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with: with:
submodules: true enable-cache: true
fetch-depth: 1
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.11' python-version: ${{ env.PYTHON_VERSION }}
architecture: x64 architecture: x64
- uses: awalsh128/cache-apt-pkgs-action@latest - name: Install uv build dependencies
with: run: uv sync --frozen --all-extras --no-install-project --no-install-workspace
packages: ripgrep build-essential python3-dev python3-setuptools libssl-dev libldap2-dev libsasl2-dev zlib1g-dev libatomic1 gnupg2 curl wget python3-ldap python3-msgpack python3-mutagen python3-regex python3-pycryptodome procps
version: 1.0
- uses: pdm-project/setup-pdm@v3
with:
python-version: '3.11'
cache: true
- name: Install dependencies
run: pdm install --fail-fast --no-lock --dev --group=':all' --no-self
- name: Build package - name: Build package
run: | run: |
pdm build uv build --all
- name: Install from build - name: Publish package distributions to PyPI
run: pip install ./dist/archivebox-*.whl uses: pypa/gh-action-pypi-publish@release/v1
- name: Add some links to test # - uses: awalsh128/cache-apt-pkgs-action@latest
run: |
mkdir data && cd data
archivebox init
archivebox add 'https://example.com'
archivebox version
archivebox status
#- name: Publish package distributions to PyPI
# run: pdm publish --no-build
# - name: Push build to PyPI
# run: |
# cd pip_dist/
# python3 -m twine upload --repository testpypi pip_dist/*.{whl,tar.gz}
# python3 -m twine upload --repository pypi pip_dist/*.{whl,tar.gz}
# - name: Commit built package
# run: |
# cd pip_dist/
# git config --local user.email "action@github.com"
# git config --local user.name "GitHub Action"
# git commit -m "Pip package autobuild" -a
# - name: Push build to Github
# uses: ad-m/github-push-action@master
# with: # with:
# github_token: ${{ secrets.GITHUB_TOKEN }} # packages: ripgrep build-essential python3-dev python3-setuptools libssl-dev libldap2-dev libsasl2-dev zlib1g-dev libatomic1 gnupg2 curl wget python3-ldap python3-msgpack python3-mutagen python3-regex python3-pycryptodome procps
# repository: ArchiveBox/pip-archivebox # version: 1.0
# branch: ${{ github.ref }}
# directory: pip_dist # - name: Install from build
# run: uv pip install ./dist/*.whl
# - name: Add some links to test
# run: |
# mkdir data && cd data
# archivebox init
# archivebox add 'https://example.com'
# archivebox version
# archivebox status