-
Notifications
You must be signed in to change notification settings - Fork 10
212 lines (180 loc) · 7.13 KB
/
build_and_release.yml
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
200
201
202
203
204
205
206
207
208
209
210
211
212
# This workflow will create a release and build multiple versions of the webrtc library.
name: build_and_release
on:
workflow_dispatch:
inputs:
fail_fast:
description: "Should stop the workflow as soon as one configuration fails"
required: false
type: boolean
default: true
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Generate Version Output
id: generate_version_output
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
shell: bash
- name: Print Version Information
run: echo "Version ${{ steps.generate_version_output.outputs.version }}"
shell: bash
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.generate_version_output.outputs.version }}
release_name: webrtc-native-build-${{ steps.generate_version_output.outputs.version }}
body: |
Latest build of webrtc-native-build
- This is a prerelease, use at your own risks.
draft: true
prerelease: true
- name: Output Release URL File
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
- name: Save Release URL File for publish
uses: actions/upload-artifact@v4
with:
name: release_url
path: release_url.txt
build-linux:
needs: create-release
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
architecture: [arm64, amd64]
build-type: [Release, Debug]
runs-on: ubuntu-22.04
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 40000
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v4
with:
name: release_url
- name: Get Upload URL
id: get_release_info
run: |
echo "upload_url=$(cat release_url.txt)" >> $GITHUB_OUTPUT
ls -l
cat release_url.txt
- name: Generate Version Output
id: generate_version_output
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
shell: bash
- name: Print Version Information
run: echo "Version ${{ steps.generate_version_output.outputs.version }}"
shell: bash
- name: Generate Release File Name
id: generate_release_file_name
run: |
echo "release_file_name=webrtc-native-build-${{ matrix.os }}-\
${{ matrix.architecture }}-\
${{ matrix.build-type }}-\
${{ steps.generate_version_output.outputs.version }}" >> $GITHUB_OUTPUT
- name: Generate Branch Name
id: generate_branch_name
run: |
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: Print Release File Name
run: echo "Release File Name ${{ steps.generate_release_file_name.outputs.release_file_name }} on branch ${{ steps.generate_branch_name.outputs.branch_name }}"
shell: bash
- name: Create and run Docker Image
working-directory: ./docker/${{ matrix.os }}
run: |
docker buildx build -t webrtc --build-arg BUILD_TYPE=${{ matrix.build-type }} --build-arg BUILD_ARCHITECTURE=${{ matrix.architecture }} --build-arg BUILD_BRANCH=${{ steps.generate_branch_name.outputs.branch_name }} .
docker run --rm --volume $PWD:/data webrtc tar cvzf /data/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz ./
ls -l
shell: bash
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./docker/${{ matrix.os }}/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz
asset_name: ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz
asset_content_type: application/x-gzip
build-mac:
needs: create-release
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-13]
architecture: [osx64]
build-type: [Release, Debug]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v4
with:
name: release_url
- name: Get Upload URL
id: get_release_info
run: |
echo "upload_url=$(cat release_url.txt)" >> $GITHUB_OUTPUT
ls -l
cat release_url.txt
- name: Generate Version Output
id: generate_version_output
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
shell: bash
- name: Print Version Information
run: echo "Version ${{ steps.generate_version_output.outputs.version }}"
shell: bash
- name: Generate Release File Name
id: generate_release_file_name
run: |
echo "release_file_name=webrtc-native-build-${{ matrix.os }}-\
${{ matrix.architecture }}-\
${{ matrix.build-type }}-\
${{ steps.generate_version_output.outputs.version }}" >> $GITHUB_OUTPUT
- name: Print Release File Name
run: echo "Release File Name ${{ steps.generate_release_file_name.outputs.release_file_name }}"
shell: bash
- name: Install system dependencies
run: |
brew install ninja
- name: Create build directory
working-directory: .
run: |
mkdir build
- name: Run CMake and build webrtc-native-build
working-directory: build
run: |
cmake ../ -DCMAKE_BUILD_TYPE=${{ matrix.build-type}} -DCMAKE_BUILD_ARCHITECTURE=${{ matrix.architecture }}
make -j3
make install
- name: Create Archive
working-directory: dist/${{ matrix.build-type }}
run: |
tar cvzf ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz webrtc-native-build-${{ steps.generate_version_output.outputs.version }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: dist/${{ matrix.build-type }}/${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz
asset_name: ${{ steps.generate_release_file_name.outputs.release_file_name }}.tar.gz
asset_content_type: application/x-gzip