-
Notifications
You must be signed in to change notification settings - Fork 7
67 lines (57 loc) · 2.05 KB
/
publish-to-test-pypi.yaml
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
name: Publish Python distributions to PyPI and TestPyPI
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-n-publish:
name: Build and publish to PyPI and TestPyPI
runs-on: ubuntu-latest
defaults:
run:
# Adding -l {0} helps ensure conda can be found properly.
shell: bash -l {0}
env:
ENV_NAME: publish
PYTHON: "3.11"
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
python-version: ${{ env.PYTHON }}
environment-file: ci/${{ env.ENV_NAME }}.yaml
activate-environment: ${{ env.ENV_NAME }}
- name: Conda Info
run: |
conda info -a
conda list
PYVER=`python -c "import sys; print('{:d}.{:d}'.format(sys.version_info.major, sys.version_info.minor))"`
if [[ $PYVER != ${{ env.PYTHON }} ]]; then
exit 1;
fi
- name: Create environment variable
if: startsWith(github.ref, 'refs/tags/') != true
run: |
wget https://gist.github.com/plaplant/0902f09e59166bac742bbd554f3cd2f9/raw/make_dev_version.sh
version=$(bash make_dev_version.sh)
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV
- name: Check environment variable
run: echo $SETUPTOOLS_SCM_PRETEND_VERSION
- name: Build a binary wheel and a source tarball
run: |
python3 -m build
- name: Publish to Test PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/[email protected]
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/[email protected]
with:
password: ${{ secrets.pypi_password }}