-
Notifications
You must be signed in to change notification settings - Fork 45
78 lines (76 loc) · 2.38 KB
/
iconsdk-publish-test-pypi.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
name: publish to test pypi
on:
workflow_dispatch:
inputs:
test_deploy:
description: 'test deploy to https://test.pypi.org'
required: false
default: 'false'
version:
description: 'test version to publish'
required: false
jobs:
unittest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Check event inputs
run: |
echo "::notice:: test_deploy=${{ github.event.inputs.test_deploy }}"
echo "::notice:: version=${{ github.event.inputs.version }}"
- name: Install dependency
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Run Test
run: |
python -m pytest -ra
test-deploy:
needs: unittest
if: github.event.inputs.test_deploy == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "3.7"
cache: pip
- name: Install dependency
run: |
python -m pip install --upgrade pip
pip install wheel
echo "::notice:: pip list"
pip list
- name: Setup test version
if: github.event.inputs.version != ''
run: |
TEST_VERSION=${{ github.event.inputs.version }}
echo "::notice:: update version from $(cat VERSION) to ${TEST_VERSION}"
echo ${TEST_VERSION} > VERSION
- name: Cache dist
id: dist_cache
uses: actions/cache@v3
with:
path: ./dist
key: ${{ runner.os }}-dist-${{ github.sha }}
- name: Build package
if: steps.dist_cache.outputs.cache-hit != 'true'
run: |
python setup.py sdist bdist_wheel
echo "::notice:: ls -al dist"
ls -al dist
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/