-
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (99 loc) · 2.92 KB
/
Copy pathrelease-test.yml
File metadata and controls
114 lines (99 loc) · 2.92 KB
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
name: Package Release Test (TestPyPi and Anaconda)
on:
workflow_dispatch:
inputs:
deploy_testpypi:
description: Publish to TestPyPI
type: boolean
default: false
deploy_anaconda:
description: Publish to Anaconda.org (test label)
type: boolean
default: false
jobs:
build:
name: Build distribution
if: inputs.deploy_testpypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v6
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
needs: build
if: inputs.deploy_testpypi
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/switcher-client
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Generate artifact attestation
uses: actions/attest@v4
with:
subject-path: 'dist/**'
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish-to-anaconda:
if: inputs.deploy_anaconda
runs-on: ubuntu-latest
environment:
name: anaconda
url: https://anaconda.org/switcherapi/switcher-client
steps:
- uses: actions/checkout@v6
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.12"
channels: conda-forge
channel-priority: strict
conda-remove-defaults: true
- name: Install build tools
shell: bash -el {0}
run: conda install -y conda-build anaconda-client
- name: Get package version
shell: bash -el {0}
run: |
PKG_VER=$(grep '__version__' switcher_client/version.py | cut -d'"' -f2)
echo "PKG_VERSION=$PKG_VER" >> $GITHUB_ENV
printf "pkg_version:\n - $PKG_VER\n" > conda.recipe/conda_build_config.yaml
- name: Build conda package
shell: bash -el {0}
run: conda build --no-test conda.recipe/ --output-folder dist/ -c conda-forge
- name: Publish distribution to Anaconda.org
shell: bash -el {0}
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
anaconda \
--token "$ANACONDA_TOKEN" \
upload \
--user switcherapi \
--label test \
--force \
$(find dist/ -name "*.tar.bz2" -o -name "*.conda")