Skip to content

Commit

Permalink
Use uv in first-party "publish" CI workflow
Browse files Browse the repository at this point in the history
- Drop use of iiasa/actions
  • Loading branch information
khaeru committed Jan 13, 2025
1 parent e056b0e commit 4f50cd0
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Build package / publish

on:
pull_request: # Check that package can be built even on PRs
# On PR commits, check build completes w/o error.
pull_request:
branches: [ main ]
push:
branches: [ main ]
# Publish on any push of a new tag, including
# 'v*rc*' pushed to a PR branch.
tags: [ "v*" ]
# Publish on new releases.
release:
types: [ published ]

Expand All @@ -15,7 +19,31 @@ concurrency:

jobs:
publish:
uses: iiasa/actions/.github/workflows/publish.yaml@main
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
TESTPYPI_TOKEN: ${{ secrets.TESTPYPI_TOKEN }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
# On 'pull_request' and some 'push' events,
# setuptools-scm will produce version '0.1.dev1'.
# To confirm that setuptools-scm generates the
# correct version string, uncomment these lines
# and adjust fetch-depth.
# with:
# fetch-depth: 10
# fetch-tags: true

- uses: astral-sh/setup-uv@v5
with:
cache-dependency-glob: "**/pyproject.toml"
python-version: "3.13"

- name: Build
run: uv build

- name: Publish
if: >-
github.event_name == 'release' || (
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
)
run: uv publish --trusted-publishing=always

0 comments on commit 4f50cd0

Please sign in to comment.