-
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (112 loc) · 3.23 KB
/
release.yml
File metadata and controls
129 lines (112 loc) · 3.23 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Package Release
on:
release:
types: [ created ]
jobs:
test:
name: Test - Python ${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Git checkout
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install pipenv
pipenv install --dev
- name: Test
run: pipenv run pytest -v
build:
name: Build distribution
needs: test
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-pypi:
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/switcher-client
permissions:
id-token: write
attestations: write
contents: read
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 PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-to-anaconda:
needs:
- build
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 main \
$(find dist/ -name "*.tar.bz2" -o -name "*.conda")