-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (66 loc) · 2.26 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
name: Publish cr.cube on TestPYPI, PYPI and Nexus
on:
release:
types: [created]
jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Autobump version
run: |
# from refs/tags/v0.1.2 get 0.1.2
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
PLACEHOLDER=$(grep '__version__ = ' src/cr/cube/__init__.py)
VERSION_FILE='src/cr/cube/__init__.py'
# ensure the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build cr.cube
run: python setup.py sdist bdist_wheel
- name: Publish on test-PYPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TESTPYPI_APIKEY }}
run: twine upload --repository testpypi dist/*
- name: Publish on PYPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }}
run: twine upload dist/*
nexus:
runs-on: ubuntu-latest
needs: pypi
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build wheels and upload to Nexus
env:
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
pip wheel . numpy==1.16.2
PYPI_NEXUS=https://ui.nexus.crint.net/repository/unstable/
for whl in *.whl; do
if [ -f $whl ]; then
echo "Twine uploading: $whl"
twine upload -r $PYPI_NEXUS --repository-url $PYPI_NEXUS -u "$NEXUS_USER" -p "$NEXUS_PASSWORD" $whl
fi
done