-
Notifications
You must be signed in to change notification settings - Fork 9
199 lines (173 loc) · 5.47 KB
/
Copy pathbuild_release.yml
File metadata and controls
199 lines (173 loc) · 5.47 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Build and Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
env:
PACKAGE_NAME: rydiqule
ANACONDA_USER: rydiqule
# Configuration for a package with no extensions and the same dependencies on all
# platforms and Python versions. For this configuration you should comment out all but
# the first entry in the job matrix of the build job since multiple platforms are not
# needed.
# Assumes the package is pure (ie does not have compiled extensions)
NOARCH: true
python_version: '3.10'
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Install Build Tools
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: Build Source Distribution
run: |
python -m build -s .
- name: Build Wheel Distribution
run: |
python -m build -w .
- name: Upload Artifact (pip)
uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist
if-no-files-found: error
- name: Set Variables for Conda Build
shell: bash
run: |
if [ $NOARCH == true ]; then
CONDA_BUILD_ARGS="--noarch"
else
CONDA_BUILD_ARGS=""
fi
echo "CONDA_BUILD_ARGS=$CONDA_BUILD_ARGS" >> $GITHUB_ENV
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.python_version }}
miniconda-version: "latest"
- name: Conda package (Unix)
shell: bash -l {0}
run: |
mkdir conda_packages
conda install conda-build
conda build conda.recipe/ -c rydiqule/label/main --no-test --no-anaconda-upload --output-folder conda_packages/
- name: Upload Artifact (conda)
uses: actions/upload-artifact@v4
with:
name: conda_packages
path: ./conda_packages/*/*.conda
if-no-files-found: error
github-release:
name: Github Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build]
permissions:
packages: read
contents: write
steps:
- name: Download Artifact (pip)
uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Get Version Number
run: |
VERSION="${GITHUB_REF/refs\/tags\/v/}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create Github Release and Upload Release Asset
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.ref }}
name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
draft: true
prerelease: ${{ contains(github.event.ref, 'rc') }}
files: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
generate_release_notes: true
test-pypi-release:
name: TestPyPI Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build, conda-release]
environment:
name: testpypi
url: https://test.pypi.org/p/${{ env.PACKAGE_NAME }}
permissions:
id-token: write
steps:
- name: Download Artifact (pip)
uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
pypi-release:
name: PyPI Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build, test-pypi-release, conda-release]
environment:
name: pypi
url: https://pypi.org/p/${{ env.PACKAGE_NAME }}
permissions:
id-token: write
steps:
- name: Download Artifact (pip)
uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
conda-release:
name: Conda Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build]
steps:
- name: Download Artifact (conda)
uses: actions/download-artifact@v4
with:
name: conda_packages
path: ./conda_packages
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ env.python_version }}
miniconda-version: "latest"
- name: Install Anaconda cloud client
shell: bash -l {0}
run: conda install anaconda-client
- name: Publish to Test Anaconda channel
shell: bash -l {0}
if: contains(github.event.ref, 'rc')
run: |
anaconda \
--token ${{ secrets.ANACONDA_API_TOKEN }} \
upload \
--user $ANACONDA_USER \
--label test \
conda_packages/*/*
- name: Publish to Anaconda channel
shell: bash -l {0}
if: contains(github.event.ref, 'rc') != true
run: |
anaconda \
--token ${{ secrets.ANACONDA_API_TOKEN }} \
upload \
--user $ANACONDA_USER \
conda_packages/*/*