Skip to content

Commit 13ad8e8

Browse files
committed
chore: Add binary deploy workflows.
1 parent c834472 commit 13ad8e8

File tree

8 files changed

+499
-76
lines changed

8 files changed

+499
-76
lines changed

.github/scripts/cmake-android

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,6 @@ jobs:
6060
- name: Build, test, and upload coverage
6161
run: other/docker/coverage/run
6262

63-
build-android:
64-
runs-on: ubuntu-22.04
65-
steps:
66-
- uses: actions/checkout@v4
67-
with:
68-
submodules: recursive
69-
- run: .github/scripts/cmake-android armeabi-v7a
70-
- run: .github/scripts/cmake-android arm64-v8a
71-
- run: .github/scripts/cmake-android x86
72-
- run: .github/scripts/cmake-android x86_64
73-
7463
build-macos:
7564
runs-on: macos-latest
7665
steps:

.github/workflows/deploy.yml

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
name: deploy
2+
3+
on:
4+
# Allow manual trigger.
5+
workflow_dispatch:
6+
pull_request:
7+
branches: ["master"]
8+
push:
9+
branches: ["master"]
10+
tags: ["v*"]
11+
12+
# Cancel old PR builds when pushing new commits.
13+
concurrency:
14+
group: deploy-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
19+
################################################################################################
20+
# Preparation jobs
21+
################################################################################################
22+
23+
update-nightly-tag:
24+
name: Update nightly release tag
25+
runs-on: ubuntu-24.04
26+
permissions:
27+
contents: write
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Move nightly tag to head for nightly release
31+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
32+
run: git tag -f nightly && git push origin nightly -f
33+
34+
################################################################################################
35+
# Build and deploy jobs (PR and push)
36+
################################################################################################
37+
38+
build-linux:
39+
name: Linux
40+
needs: [update-nightly-tag]
41+
strategy:
42+
matrix:
43+
arch: [aarch64, x86_64]
44+
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
submodules: recursive
49+
- name: Install build tools
50+
run: sudo apt-get install -y --no-install-recommends ninja-build yasm
51+
- name: Cache dependencies
52+
uses: actions/cache@v4
53+
with:
54+
path: prefix
55+
key: ${{ github.job }}-${{ matrix.arch }}-deps
56+
- name: Run build
57+
run: other/deploy/linux.sh
58+
- name: Upload artifacts
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: toxcore-linux-${{ matrix.arch }}
62+
path: toxcore-linux-${{ matrix.arch }}
63+
- name: Get tag name for release file name
64+
if: contains(github.ref, 'refs/tags/v')
65+
id: get_version
66+
run: |
67+
VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)"
68+
echo "release_tarball=toxcore-$VERSION-linux-${{ matrix.arch }}.tar.gz" >>$GITHUB_OUTPUT
69+
- name: Create tarball for release upload
70+
if: contains(github.ref, 'refs/tags/v')
71+
run: |
72+
tar zcf "${{ steps.get_version.outputs.release_tarball }}" toxcore-linux-${{ matrix.arch }}
73+
sha256sum "${{ steps.get_version.outputs.release_tarball }}" > "${{ steps.get_version.outputs.release_tarball }}.sha256"
74+
- name: Upload to versioned release
75+
if: contains(github.ref, 'refs/tags/v')
76+
uses: ncipollo/release-action@v1
77+
with:
78+
allowUpdates: true
79+
draft: true
80+
token: ${{ secrets.GITHUB_TOKEN }}
81+
artifacts: "${{ steps.get_version.outputs.release_tarball }},${{ steps.get_version.outputs.release_tarball }}.sha256"
82+
- name: Create tarball for nightly upload
83+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
84+
run: |
85+
tar zcf toxcore-nightly-linux-${{ matrix.arch }}.tar.gz toxcore-linux-${{ matrix.arch }}
86+
sha256sum toxcore-nightly-linux-${{ matrix.arch }}.tar.gz > toxcore-nightly-linux-${{ matrix.arch }}.tar.gz.sha256
87+
- name: Upload to nightly release
88+
uses: ncipollo/release-action@v1
89+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
90+
with:
91+
allowUpdates: true
92+
tag: nightly
93+
omitBodyDuringUpdate: true
94+
omitNameDuringUpdate: true
95+
prerelease: true
96+
replacesArtifacts: true
97+
token: ${{ secrets.GITHUB_TOKEN }}
98+
artifacts: "toxcore-nightly-linux-${{ matrix.arch }}.tar.gz,toxcore-nightly-linux-${{ matrix.arch }}.tar.gz.sha256"
99+
100+
build-macos:
101+
name: macOS
102+
needs: [update-nightly-tag]
103+
strategy:
104+
matrix:
105+
arch: [arm64, x86_64]
106+
runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }}
107+
steps:
108+
- uses: actions/checkout@v4
109+
with:
110+
submodules: recursive
111+
- name: Install build tools
112+
run: brew install coreutils ninja yasm
113+
- name: Cache dependencies
114+
uses: actions/cache@v4
115+
with:
116+
path: prefix
117+
key: ${{ github.job }}-${{ matrix.arch }}-deps
118+
- name: Run build
119+
run: other/deploy/macos.sh
120+
- name: Upload artifacts
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: toxcore-macos-${{ matrix.arch }}
124+
path: toxcore-macos-${{ matrix.arch }}
125+
- name: Get tag name for release file name
126+
if: contains(github.ref, 'refs/tags/v')
127+
id: get_version
128+
run: |
129+
VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)"
130+
echo "release_tarball=toxcore-$VERSION-macos-${{ matrix.arch }}.tar.gz" >>$GITHUB_OUTPUT
131+
- name: Create tarball for release upload
132+
if: contains(github.ref, 'refs/tags/v')
133+
run: |
134+
tar zcf "${{ steps.get_version.outputs.release_tarball }}" toxcore-macos-${{ matrix.arch }}
135+
sha256sum "${{ steps.get_version.outputs.release_tarball }}" > "${{ steps.get_version.outputs.release_tarball }}.sha256"
136+
- name: Upload to versioned release
137+
if: contains(github.ref, 'refs/tags/v')
138+
uses: ncipollo/release-action@v1
139+
with:
140+
allowUpdates: true
141+
draft: true
142+
token: ${{ secrets.GITHUB_TOKEN }}
143+
artifacts: "${{ steps.get_version.outputs.release_tarball }},${{ steps.get_version.outputs.release_tarball }}.sha256"
144+
- name: Create tarball for nightly upload
145+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
146+
run: |
147+
tar zcf toxcore-nightly-macos-${{ matrix.arch }}.tar.gz toxcore-macos-${{ matrix.arch }}
148+
sha256sum toxcore-nightly-macos-${{ matrix.arch }}.tar.gz > toxcore-nightly-macos-${{ matrix.arch }}.tar.gz.sha256
149+
- name: Upload to nightly release
150+
uses: ncipollo/release-action@v1
151+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
152+
with:
153+
allowUpdates: true
154+
tag: nightly
155+
omitBodyDuringUpdate: true
156+
omitNameDuringUpdate: true
157+
prerelease: true
158+
replacesArtifacts: true
159+
token: ${{ secrets.GITHUB_TOKEN }}
160+
artifacts: "toxcore-nightly-macos-${{ matrix.arch }}.tar.gz,toxcore-nightly-macos-${{ matrix.arch }}.tar.gz.sha256"
161+
162+
build-ios:
163+
name: iOS
164+
needs: [update-nightly-tag]
165+
strategy:
166+
matrix:
167+
arch: [arm64]
168+
runs-on: 'macos-14'
169+
steps:
170+
- uses: actions/checkout@v4
171+
with:
172+
submodules: recursive
173+
- name: Install build tools
174+
run: brew install coreutils ninja yasm
175+
- name: Cache dependencies
176+
uses: actions/cache@v4
177+
with:
178+
path: prefix
179+
key: ${{ github.job }}-${{ matrix.arch }}-deps
180+
- name: Run build
181+
run: other/deploy/ios.sh
182+
- name: Upload artifacts
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: toxcore-ios-${{ matrix.arch }}
186+
path: toxcore-ios-${{ matrix.arch }}
187+
- name: Get tag name for release file name
188+
if: contains(github.ref, 'refs/tags/v')
189+
id: get_version
190+
run: |
191+
VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)"
192+
echo "release_tarball=toxcore-$VERSION-ios-${{ matrix.arch }}.tar.gz" >>$GITHUB_OUTPUT
193+
- name: Create tarball for release upload
194+
if: contains(github.ref, 'refs/tags/v')
195+
run: |
196+
tar zcf "${{ steps.get_version.outputs.release_tarball }}" toxcore-ios-${{ matrix.arch }}
197+
sha256sum "${{ steps.get_version.outputs.release_tarball }}" > "${{ steps.get_version.outputs.release_tarball }}.sha256"
198+
- name: Upload to versioned release
199+
if: contains(github.ref, 'refs/tags/v')
200+
uses: ncipollo/release-action@v1
201+
with:
202+
allowUpdates: true
203+
draft: true
204+
token: ${{ secrets.GITHUB_TOKEN }}
205+
artifacts: "${{ steps.get_version.outputs.release_tarball }},${{ steps.get_version.outputs.release_tarball }}.sha256"
206+
- name: Create tarball for nightly upload
207+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
208+
run: |
209+
tar zcf toxcore-nightly-ios-${{ matrix.arch }}.tar.gz toxcore-ios-${{ matrix.arch }}
210+
sha256sum toxcore-nightly-ios-${{ matrix.arch }}.tar.gz > toxcore-nightly-ios-${{ matrix.arch }}.tar.gz.sha256
211+
- name: Upload to nightly release
212+
uses: ncipollo/release-action@v1
213+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
214+
with:
215+
allowUpdates: true
216+
tag: nightly
217+
omitBodyDuringUpdate: true
218+
omitNameDuringUpdate: true
219+
prerelease: true
220+
replacesArtifacts: true
221+
token: ${{ secrets.GITHUB_TOKEN }}
222+
artifacts: "toxcore-nightly-ios-${{ matrix.arch }}.tar.gz,toxcore-nightly-ios-${{ matrix.arch }}.tar.gz.sha256"
223+
224+
build-android:
225+
name: Android
226+
needs: [update-nightly-tag]
227+
strategy:
228+
matrix:
229+
arch: [armeabi-v7a, arm64-v8a, x86, x86_64]
230+
runs-on: ubuntu-24.04
231+
steps:
232+
- uses: actions/checkout@v4
233+
with:
234+
submodules: recursive
235+
- name: Install build tools
236+
run: sudo apt-get install -y --no-install-recommends ninja-build yasm
237+
- name: Cache dependencies
238+
uses: actions/cache@v4
239+
with:
240+
path: prefix
241+
key: ${{ github.job }}-${{ matrix.arch }}-deps
242+
- name: Run build
243+
run: other/deploy/android.sh "${{ matrix.arch }}"
244+
- name: Upload artifacts
245+
uses: actions/upload-artifact@v4
246+
with:
247+
name: toxcore-android-${{ matrix.arch }}
248+
path: toxcore-android-${{ matrix.arch }}
249+
- name: Get tag name for release file name
250+
if: contains(github.ref, 'refs/tags/v')
251+
id: get_version
252+
run: |
253+
VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)"
254+
echo "release_tarball=toxcore-$VERSION-android-${{ matrix.arch }}.tar.gz" >>$GITHUB_OUTPUT
255+
- name: Create tarball for release upload
256+
if: contains(github.ref, 'refs/tags/v')
257+
run: |
258+
tar zcf "${{ steps.get_version.outputs.release_tarball }}" toxcore-android-${{ matrix.arch }}
259+
sha256sum "${{ steps.get_version.outputs.release_tarball }}" > "${{ steps.get_version.outputs.release_tarball }}.sha256"
260+
- name: Upload to versioned release
261+
if: contains(github.ref, 'refs/tags/v')
262+
uses: ncipollo/release-action@v1
263+
with:
264+
allowUpdates: true
265+
draft: true
266+
token: ${{ secrets.GITHUB_TOKEN }}
267+
artifacts: "${{ steps.get_version.outputs.release_tarball }},${{ steps.get_version.outputs.release_tarball }}.sha256"
268+
- name: Create tarball for nightly upload
269+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
270+
run: |
271+
tar zcf toxcore-nightly-android-${{ matrix.arch }}.tar.gz toxcore-android-${{ matrix.arch }}
272+
sha256sum toxcore-nightly-android-${{ matrix.arch }}.tar.gz > toxcore-nightly-android-${{ matrix.arch }}.tar.gz.sha256
273+
- name: Upload to nightly release
274+
uses: ncipollo/release-action@v1
275+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
276+
with:
277+
allowUpdates: true
278+
tag: nightly
279+
omitBodyDuringUpdate: true
280+
omitNameDuringUpdate: true
281+
prerelease: true
282+
replacesArtifacts: true
283+
token: ${{ secrets.GITHUB_TOKEN }}
284+
artifacts: "toxcore-nightly-android-${{ matrix.arch }}.tar.gz,toxcore-nightly-android-${{ matrix.arch }}.tar.gz.sha256"

0 commit comments

Comments
 (0)