build: added dependabot-uv workflow (#323) #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds and publishes to testpypi on every push to main | |
# On release, publishes to pypi | |
name: publish | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
env: | |
PYTHON_VERSION: 3.11 | |
UV_VERSION: 0.4.25 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: ${{ env.UV_VERSION }} | |
enable-cache: true | |
- name: Set version with dunamai | |
uses: mtkennerly/dunamai-action@v1 | |
id: version | |
with: | |
command: dunamai from git | |
args: --no-metadata --style semver | |
- name: set version from dunamai | |
- run: sed -i -e "s/0.0.0/${{ steps.version.outputs.version }}/" pyproject.toml | |
- name: uv build | |
run: uv build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: uv_build | |
path: dist/ | |
publish_test_pypi: | |
if: github.repository_owner == 'ryankanno' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: ${{ env.UV_VERSION }} | |
enable-cache: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: uv_build | |
path: dist/ | |
- name: uv publish TestPyPi | |
env: | |
UV_PUBLISH_URL: https://test.pypi.org/legacy/ | |
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
run: | | |
uv publish | |
publish_pypi: | |
if: github.repository_owner == 'ryankanno' && github.event_name == 'release' && github.event.action == 'published' | |
runs-on: ubuntu-latest | |
needs: [build, publish_test_pypi] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: ${{ env.UV_VERSION }} | |
enable-cache: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: uv_build | |
path: dist/ | |
- name: uv publish PyPi | |
env: | |
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
uv publish |