forked from lichess-org/berserk
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.12 KB
/
release.yml
File metadata and controls
74 lines (65 loc) · 2.12 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Publish to Pypi (and testPypi)
on:
workflow_dispatch:
inputs:
bump:
description: 'bump version: major, minor, patch, or none to build current dev'
required: true
type: choice
options:
- none
- major
- minor
- patch
environment:
description: 'Target environment: testpypi or pypi'
required: true
type: choice
options:
- testpypi
- pypi
default: 'testpypi'
jobs:
build:
name: Build package
runs-on: ubuntu-latest
permissions:
contents: write
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v5
- name: Configure Git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build berserk package
run: uv run release.py --bump ${{ github.event.inputs.bump }} --branch ${{ env.BRANCH_NAME }}
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: Publish to ${{ github.event.inputs.environment }}
needs:
- build
runs-on: ubuntu-latest
if: github.event.inputs.environment == 'testpypi' || github.event.inputs.environment == 'pypi'
environment:
name: ${{ github.event.inputs.environment }}
url: ${{ github.event.inputs.environment == 'testpypi' && 'https://test.pypi.org/p/berserk' || 'https://pypi.org/p/berserk' }}
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish to ${{ github.event.inputs.environment }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: ${{ github.event.inputs.environment == 'testpypi' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}