-
Notifications
You must be signed in to change notification settings - Fork 334
58 lines (52 loc) · 1.85 KB
/
Copy pathpublish.yml
File metadata and controls
58 lines (52 loc) · 1.85 KB
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
55
56
57
58
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: publish
on:
release:
types: [published] # publish full release to PyPI when a release is created on Github
schedule:
- cron: "0 17 * * FRI" # tag a pre-release on Github every Friday at 5 PM UTC
permissions:
contents: write
jobs:
tag_pre_release:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
defaults:
run:
working-directory: workflows
steps:
- uses: actions/checkout@v4
- name: Create pre-release tag
run: |
git fetch --tags
latest_tag=$(git tag --list --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$' | head -n 1)
if [ -z "$latest_tag" ]; then
new_tag="v0.1.0rc1"
else
new_tag=$(echo $latest_tag | awk -F'rc' '{print $1 "rc" $2+1}')
fi
git tag $new_tag
git push origin $new_tag
publish_to_pypi:
if: github.event_name == 'release'
runs-on: ubuntu-latest
defaults:
run:
working-directory: workflows
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }} # Checkout the release tag commit
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: astral-sh/setup-uv@v5
- run: uv run ruff check --no-fix --select PLE # check only for syntax errors
- run: uv build
- run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}