-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (54 loc) · 2.07 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
# Workflow to upload a Python Package using Twine when a release is created
name: Release to PyPI
on:
release:
types: [released]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Install from testpypi and import
shell: bash
run: |
sleep 5
while [ "${{ github.ref_name }}" != $(pip index versions -i https://test.pypi.org/simple --pre market-analy | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
do echo "waiting for package to appear in test index, sleeping 5s"; sleep 5s; echo "woken up"; done
pip install --index-url https://test.pypi.org/simple market-analy==${{ github.ref_name }} --no-deps
pip install -r etc/requirements.txt
python -c 'import market_analy;print(market_analy.__version__)'
- name: Clean pip
run: |
pip uninstall -y market_analy
pip cache purge
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Install and import
shell: bash
run: |
sleep 5
while [ "${{ github.ref_name }}" != $(pip index versions -i https://pypi.org/simple --pre market-analy | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
do echo "waiting for package to appear in index, sleeping 5s"; sleep 5s; echo "woken up"; done
pip install --index-url https://pypi.org/simple market-analy==${{ github.ref_name }}
python -c 'import market_analy;print(market_analy.__version__)'