-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (54 loc) · 1.64 KB
/
publish_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
name: Publish Release
on:
workflow_dispatch:
inputs:
version:
type: string
required: true
description: "Release version (e.g. 1.2.3). Corresponding tag (v1.2.3) should already exist."
to_testpypi:
type: boolean
required: true
default: true
description: "Publish to testpypi."
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: v${{ inputs.version }}
- name: Install Python 3
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Validate version
shell: bash
run: |
pip install --upgrade pip packaging
python3 - <<END
from packaging.version import parse
if not parse("${{ inputs.version }}"):
exit(1)
END
- name: update version
shell: bash
run: |
echo "__version__ = '${{ inputs.version }}'" > sony_custom_layers/version.py
echo "sony_custom_layers/version.py content:"
cat sony_custom_layers/version.py
- name: Build wheel
shell: bash
run: |
pip install build twine
python -m build --wheel
- name: Publish package pypi
if: inputs.to_testpypi == false
shell: bash
run: |
twine upload --repository pypi dist/* -u __token__ -p ${{ secrets.PYPI_API_KEY }}
- name: Publish package testpypi
if: inputs.to_testpypi == true
shell: bash
run: |
twine upload --repository testpypi dist/* -u __token__ -p ${{ secrets.TEST_PYPI_API_KEY }}