-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (124 loc) · 5.97 KB
/
release.yml
File metadata and controls
154 lines (124 loc) · 5.97 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
name: Build and Upload Release Binaries
on:
release:
types: [created]
permissions:
id-token: write
contents: write
jobs:
linux_windows:
runs-on: ubuntu-latest
steps:
- name: Set the upload url
run: |
echo "UPLOAD_URL=$(echo '${{ github.event.release.upload_url }}' | sed 's/{.*//')" >> $GITHUB_ENV
- name: Print the upload url
run: |
echo "Upload URL: ${UPLOAD_URL}"
- name: Checkout the repository
uses: actions/checkout@v4
- name: Get the release version from the tag
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- name: Install Linux, Windows Cross and Protobuf Compilers
run: sudo apt-get install --yes --no-install-recommends musl-tools gcc-mingw-w64-x86-64-win32 protobuf-compiler
- name: Install rustup targets
run: rustup target add x86_64-unknown-linux-musl x86_64-pc-windows-gnu
- name: Build
run: cargo build --release --target x86_64-unknown-linux-musl --target x86_64-pc-windows-gnu
- name: Tar Linux binary
run: tar -czvf ace-audio-stream-forwarding-simulator_x86_64-unknown-linux-musl.tar.gz README.md data/ -C target/x86_64-unknown-linux-musl/release ace-audio-stream-forwarding-simulator ace-audio-stream-forwarding-example-server
- name: Zip Windows binary
run: zip -j ace-audio-stream-forwarding-simulator_x86_64-pc-windows-gnu.zip README.md data/ target/x86_64-pc-windows-gnu/release/ace-audio-stream-forwarding-simulator.exe target/x86_64-pc-windows-gnu/release/ace-audio-stream-example-server.exe
- name: SHA256 checksums
run: |
shasum -a 256 ace-audio-stream-forwarding-simulator_x86_64-unknown-linux-musl.tar.gz > ace-audio-stream-forwarding-simulator_x86_64-unknown-linux-musl.tar.gz.sha256
shasum -a 256 ace-audio-stream-forwarding-simulator_x86_64-pc-windows-gnu.zip > ace-audio-stream-forwarding-simulator_x86_64-pc-windows-gnu.zip.sha256
- name: List directory
run: ls -lha
- name: Upload release assets
run: |
for FILE_NAME in \
ace-audio-stream-forwarding-simulator_x86_64-unknown-linux-musl.tar.gz \
ace-audio-stream-forwarding-simulator_x86_64-pc-windows-gnu.zip \
ace-audio-stream-forwarding-simulator_x86_64-unknown-linux-musl.tar.gz.sha256 \
ace-audio-stream-forwarding-simulator_x86_64-pc-windows-gnu.zip.sha256; do
echo "Uploading $FILE_NAME..."
curl -L \
--fail-with-body \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"${UPLOAD_URL}?name=${FILE_NAME}" \
--data-binary @"${FILE_NAME}"
done
macos:
runs-on: macos-latest
steps:
- name: Set the upload url
run: |
echo "UPLOAD_URL=$(echo '${{ github.event.release.upload_url }}' | sed 's/{.*//')" >> $GITHUB_ENV
- name: Print the upload url
run: |
echo "Upload URL: ${UPLOAD_URL}"
- name: Checkout the repository
uses: actions/checkout@v4
- name: Get the release version from the tag
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- name: Install rustup targets
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
- name: Install protocol buffers compiler
run: brew install protobuf
- name: Build
run: cargo build --release --target=x86_64-apple-darwin --target=aarch64-apple-darwin
- name: Zip x86_64 binaries
run: tar -czvf ace-audio-stream-forwarding-simulator_x86_64-apple-darwin.tar.gz README.md data/ -C target/x86_64-apple-darwin/release ace-audio-stream-forwarding-simulator ace-audio-stream-forwarding-example-server
- name: Zip arm64 binaries
run: tar -czvf ace-audio-stream-forwarding-simulator_aarch64-apple-darwin.tar.gz README.md data/ -C target/aarch64-apple-darwin/release ace-audio-stream-forwarding-simulator ace-audio-stream-forwarding-example-server
- name: Generate SHA256 checksums
run: |
shasum -a 256 ace-audio-stream-forwarding-simulator_x86_64-apple-darwin.tar.gz > ace-audio-stream-forwarding-simulator_x86_64-apple-darwin.tar.gz.sha256
shasum -a 256 ace-audio-stream-forwarding-simulator_aarch64-apple-darwin.tar.gz > ace-audio-stream-forwarding-simulator_aarch64-apple-darwin.tar.gz.sha256
- name: List directory
run: ls -lha
- name: Upload release assets
run: |
for FILE_NAME in \
ace-audio-stream-forwarding-simulator_x86_64-apple-darwin.tar.gz \
ace-audio-stream-forwarding-simulator_aarch64-apple-darwin.tar.gz \
ace-audio-stream-forwarding-simulator_x86_64-apple-darwin.tar.gz.sha256 \
ace-audio-stream-forwarding-simulator_aarch64-apple-darwin.tar.gz.sha256; do
echo "Uploading $FILE_NAME..."
curl -L \
--fail-with-body \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
"${UPLOAD_URL}?name=${FILE_NAME}" \
--data-binary @"${FILE_NAME}"
done