-
Notifications
You must be signed in to change notification settings - Fork 51
122 lines (102 loc) · 3.17 KB
/
pypi_deployment.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
name: pomdp-py package pypi deployment
on:
push:
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
testpypi-publish:
name: publish to Test PyPi
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/tags/vdev-latest' }}
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
environment:
name: testpypi
url: https://test.pypi.org/p/pomdp-py/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write
steps:
- name: Set Variables
if: startsWith(github.ref, 'refs/tags/v')
run: echo "RELEASE_NAME=\"Version ${{ github.ref_name }}\"" >> $GITHUB_ENV
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
with:
ref: 'dev-latest'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Run release script
working-directory: .
run: |
cd scripts
./pomdp_py_release.sh ${{ vars.RELEASE_ATTEMPT_COUNT }}
- name: Upload to Test PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
# This will upload stuff under dist/ to PyPI
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip-existing: true
- name: Release artifact
uses: softprops/action-gh-release@v1
with:
name: ${{ env.RELEASE_NAME }}
files: dist/*.whl
pypi-publish:
name: publish to PyPi
runs-on: ubuntu-latest
if: ${{ github.ref != 'refs/tags/vdev-latest' }}
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
environment:
name: pypi
url: https://pypi.org/p/pomdp-py/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write
steps:
- name: Set Variables
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG=${{ github.ref_name }}
echo "RELEASE_NAME=\"Version $TAG\"" >> $GITHUB_ENV
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
with:
ref: "dev-${{ env.VERSION }}"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Run release script
working-directory: .
run: |
cd scripts
./pomdp_py_release.sh ${{ vars.RELEASE_ATTEMPT_COUNT }}
- name: Upload to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
# This will upload stuff under dist/ to PyPI
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository_url: https://pypi.org/
skip-existing: true
- name: Release artifact
uses: softprops/action-gh-release@v1
with:
name: ${{ env.RELEASE_NAME }}
files: dist/*.whl