-
Notifications
You must be signed in to change notification settings - Fork 9
169 lines (163 loc) · 6.12 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:
release:
types: [published]
jobs:
build:
name: 🔨 Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🏗 Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 🏗 Install build dependencies
run: |
python -m pip install -U wheel build setuptools --user
- name: 🔨 Build a binary wheel and a source tarball
run: |
python -m build --wheel
- name: ⬆ Upload build result
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- name: ➕ Upload wheel to GH release page
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && github.repository == 'Pioreactor/pioreactor'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*.whl
tag: ${{ github.event.release.tag_name }}
overwrite: true
file_glob: true
- name: ➕ Upload CHANGELOG to GH release page
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && github.repository == 'Pioreactor/pioreactor'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: CHANGELOG.md
tag: ${{ github.event.release.tag_name }}
overwrite: true
file_glob: true
build-deps:
name: 🔨 Build dependencies and upload
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🏗 Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: 🏗 Install dependencies
run: |
python -m pip install --upgrade pip
- name: 🔨 Download wheels for all dependencies
run: |
pip download -d wheels -r requirements/requirements_leader_worker.txt --index-url https://piwheels.org/simple --platform linux_armv7l --platform linux_armv6l --platform manylinux_2_36_armv7l --only-binary=:all: --extra-index-url https://pypi.org/simple --python-version 311
- name: Zip the wheels
run: |
cd wheels
zip -r ../wheels_${{ github.event.release.tag_name }}.zip .
- name: Upload zipped wheels
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: wheels_${{ github.event.release.tag_name }}.zip
tag: ${{ github.event.release.tag_name }}
overwrite: true
fetch-pioreactorui-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Latest Release
id: get-latest-release
run: |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/pioreactor/pioreactorui/releases/latest)
TAG=$(echo $LATEST_RELEASE | jq -r .tag_name)
echo "RELEASE_UI_TAG=$TAG" >> $GITHUB_ENV
echo "RELEASE_UI_URL=https://github.com/pioreactor/pioreactorui/archive/refs/tags/$TAG.tar.gz" >> $GITHUB_ENV
- name: Download Release Tarball
run: |
curl -L $RELEASE_UI_URL -o pioreactorui_${{ env.RELEASE_UI_TAG }}.tar.gz
- name: Upload UI tarball
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pioreactorui_${{ env.RELEASE_UI_TAG }}.tar.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
zip-asset-upload:
name: 🤐 Zip assets and upload
runs-on: ubuntu-latest
needs: [build, build-deps, fetch-pioreactorui-release]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download release assets
run: |
curl -s https://api.github.com/repos/pioreactor/pioreactor/releases/tags/${{ github.event.release.tag_name }} | jq -r '.assets[].browser_download_url' > assets.txt
mkdir release_assets
cd release_assets
while read -r line; do
echo "$line"
wget "$line"
done < ../assets.txt
[ -f pre_update.sh ] || touch pre_update.sh
[ -f update.sh ] || touch update.sh
[ -f post_update.sh ] || touch post_update.sh
[ -f update.sql ] || touch update.sql
- name: Zip the assets and produce hash
run: |
cd release_assets
zip -r ../release_${{ github.event.release.tag_name }}.zip .
sha256sum ../release_${{ github.event.release.tag_name }}.zip > ../release_${{ github.event.release.tag_name }}.zip.sha256
- name: Upload zipped assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release_${{ github.event.release.tag_name }}.zip
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload hash
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: release_${{ github.event.release.tag_name }}.zip.sha256
tag: ${{ github.event.release.tag_name }}
overwrite: true
publish-on-pypi:
name: 📦 Publish tagged releases to PyPI
runs-on: ubuntu-latest
needs: build
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: 📦 Publish to index
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PIOREACTOR_PYPI_API_TOKEN }}
notify-custopizer-build:
name: 📧 Notify Pioreactor/CustoPizer
runs-on: ubuntu-latest
needs: build
steps:
- name: 👀 Determine version
run: |
echo "PIOREACTOR_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: 🚀 Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPODISPATCH_TOKEN }}
repository: Pioreactor/CustoPizer
event-type: pioreactor_release
client-payload: '{"version": "${{ env.PIOREACTOR_VERSION }}"}'