-
Notifications
You must be signed in to change notification settings - Fork 5
54 lines (48 loc) · 1.52 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Based on
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python distributions to PyPI
on:
push:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
permissions:
contents: read
env:
FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
CLICOLOR_FORCE: 1 # recognized by uv
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
permissions:
# needed for PyPI trusted publishing
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- if: ${{ github.event_name != 'push' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
DATE=$(date '+%y.%-m.%-d')
echo "${DATE}"
git config --global user.name releasebot
git config --global user.email ""
git tag -a "${DATE}" -m ""
git push --tags
gh release create "${DATE}" --notes "Automated weekly release"
- name: Build a binary wheel and a source tarball
run: uv build
- name: Publish distribution to PyPI
if: ${{ github.event_name != 'push' || startsWith(github.ref, 'refs/tags') }}
run: uv publish