-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (162 loc) · 5.29 KB
/
build.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
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
name: Build
on:
push:
branches:
- master
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.step1.outputs.v }}
steps:
- uses: actions/checkout@v4
- name: Get version number
id: step1
run: echo "v=$(grep ':Version:' README.rst | awk '{print $2}')" >> $GITHUB_OUTPUT
git-tag-and-release:
runs-on: ubuntu-latest
needs: get-version
steps:
- uses: actions/checkout@v4
- name: set version number
run: echo "DIST_VERSION=v${{ needs.get-version.outputs.version }}" >> $GITHUB_ENV
- name: Create Tag
uses: actions/github-script@v6
with:
script: |
const {DIST_VERSION} = process.env
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${DIST_VERSION}`,
sha: context.sha
})
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
name: "${{ env.DIST_VERSION }}"
tag: "${{ env.DIST_VERSION }}"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
pypi-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install pypa/build
run: python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
pypi-public:
needs:
- get-version
- pypi-release
runs-on: ubuntu-latest
steps:
- name: Wait for PyPi
uses: nev7n/wait_for_response@v1
with:
url: "https://files.pythonhosted.org/packages/source/n/nsbi/nsbi-${{ needs.get-version.outputs.version }}.tar.gz"
responseCode: 200
timeout: 600000
interval: 10000
aur-release:
needs: pypi-public
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tomli
- name: Generate PKGBUILD
run: python ./bin/gen_PKGBUILD.py > ./PKGBUILD
- name: Publish AUR package
uses: KSXGitHub/[email protected]
with:
pkgname: python-nsbi
pkgbuild: ./PKGBUILD
updpkgsums: True
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
conda-release:
needs: pypi-public
name: Build and deploy to conda
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.9'
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
channels: conda-forge,handley-lab
- name: install dependencies
shell: bash -el {0}
run: conda install grayskull conda-build anaconda-client
- name: Generate meta.yaml from grayskull
shell: bash -el {0}
run: grayskull pypi --strict-conda-forge nsbi
- name: Build and upload the conda packages
uses: uibcdf/[email protected]
with:
meta_yaml_dir: nsbi
python-version: '3.9'
user: handley-lab
label: 'main'
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret
conda-build:
needs:
- conda-release
- get-version
name: test installation from conda
runs-on: ubuntu-latest
steps:
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.9'
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: install from conda
shell: bash -el {0}
run: conda install -c handley-lab nsbi
- name: get install version
shell: bash -el {0}
run: echo "install_version=$(python -c 'import nsbi; print(nsbi.__version__)')" >> $GITHUB_ENV
- name: fail if versions not matching
if: ${{ env.install_version != needs.get-version.outputs.version }}
run: exit 1
pypi-build:
needs:
- pypi-public
- get-version
name: test installation from pypi
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install from pypi
run: pip install nsbi
- name: get install version
run: echo "install_version=$(python -c 'import nsbi; print(nsbi.__version__)')" >> $GITHUB_ENV
- name: fail if versions not matching
if: ${{ env.install_version != needs.get-version.outputs.version }}
run: exit 1