-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (133 loc) · 4.73 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
name: Build and release
on:
push:
branches:
- "ci"
tags:
- "*"
jobs:
build-armhf:
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
- name: Install Docker
run: |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
- name: Checkout sources
uses: actions/checkout@v2
- name: Build rust-streamium server
run: |
docker build -t rust-streamium-build -f docker/armhf-rust-buildenv/Dockerfile .
docker create --name rust-streamium rust-streamium-build
docker cp rust-streamium:/app/streamium-server/target/armv7-unknown-linux-gnueabihf/release/streamium-server ./streamium-server
docker rm rust-streamium
- name: Upload binary
uses: actions/upload-artifact@v1
with:
path: ./streamium-server
name: streamium-server_armhf
build-amd64:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Install toolchain
run: |
sudo apt-get update
sudo apt install build-essential
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
override: true
- name: Install additional libraries
run: |
sudo apt-get update || true
sudo apt-get install libsasl2-modules-gssapi-mit libpq-dev
- name: Create cached directory
run: |
mkdir -p ~/.cargo/registry
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-amd64-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: |
cd streamium-server && cargo build --release
- name: Upload binary
uses: actions/upload-artifact@v1
with:
path: streamium-server/target/release/streamium-server
name: streamium-server_amd64
deploy-templates:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Zip templates
run: |
cd streamium-server && zip templates templates/*
- name: Upload binary
uses: actions/upload-artifact@v1
with:
path: streamium-server/templates.zip
name: templates.zip
release:
runs-on: ubuntu-22.04
if: ${{ startsWith(github.ref, 'refs/tags') }}
needs: [build-armhf, build-amd64, deploy-templates]
steps:
- name: Download armhf binary
uses: actions/download-artifact@v1
with:
name: streamium-server_armhf
path: ./streamium-server_armhf
- name: Download amd64 binary
uses: actions/download-artifact@v1
with:
name: streamium-server_amd64
path: ./streamium-server_amd64
- name: Download templates
uses: actions/download-artifact@v1
with:
name: templates.zip
path: ./
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Attach armhf binary to release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: streamium-server_armhf/streamium-server
asset_name: streamium-server_armhf
asset_content_type: application/octet-stream
- name: Attach amd64 binary to release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: streamium-server_amd64/streamium-server
asset_name: streamium-server_amd64
asset_content_type: application/octet-stream
- name: Attach templates.zip to release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: templates.zip
asset_name: templates.zip
asset_content_type: application/zip