-
Notifications
You must be signed in to change notification settings - Fork 228
123 lines (98 loc) · 3.36 KB
/
release.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Release
on:
push:
tags:
- 'v[0-9]*'
jobs:
run-tests:
name: Run all tests
uses: ./.github/workflows/testing.yml
with:
skip_codecov: true
check-semver-tag:
name: Check if the tag is in semantic version format
needs: [run-tests]
runs-on: ubuntu-latest
outputs:
tag_type: ${{ steps.check-tag.outputs.tag_type }}
publish_on: ${{ steps.check-tag.outputs.publish_on }}
strategy:
matrix:
python-version: ["3.13"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Make uv use system python
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV
- name: Check for semantic version tag
id: check-tag
run: python tools/gha_check_semver.py
- name: See outputs
shell: bash
run: |
echo "tag_type="${{ steps.check-tag.outputs.tag_type }}
echo "publish_on="${{ steps.check-tag.outputs.publish_on }}
# Ref: https://github.com/pypa/gh-action-pypi-publish
publish:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI or PyPI
needs: [check-semver-tag]
runs-on: ubuntu-latest
if: ${{ needs.check-semver-tag.outputs.publish_on != '' }}
environment:
name: release
url: https://github.com/has2k1/plotnine
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
strategy:
matrix:
python-version: ["3.13"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install a specific version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Make uv use system python
run: echo "UV_SYSTEM_PYTHON=true" >> $GITHUB_ENV
- name: Install Packages
run: uv pip install build
- name: Build a wheel and a source tarball
run: make dist
- name: Publish distribution 📦 to Test PyPI
if: ${{ needs.check-semver-tag.outputs.publish_on == 'testpypi' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish distribution 📦 to PyPI
if: ${{ needs.check-semver-tag.outputs.publish_on == 'pypi' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
- name: Build Website (Dev)
if: ${{ needs.check-semver-tag.outputs.publish_on == 'testpypi' }}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT_PLOTNINE_WEBSITE }}
repository: has2k1/plotnine.org
event-type: plotnine-pre-release
- name: Build Website
if: ${{ needs.check-semver-tag.outputs.publish_on == 'pypi' }}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT_PLOTNINE_WEBSITE }}
repository: has2k1/plotnine.org
event-type: plotnine-release