This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (136 loc) · 4.78 KB
/
build.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
name: Build RTME
env:
GHCR: "ghcr.io"
DOCKER_IMAGE_NAME: "dolbyio/real-time-media-extensions"
on:
pull_request:
branches:
- main
push:
tags:
- '*'
jobs:
build-resources:
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get --quiet update
sudo apt-get --quiet install python3-pkg-resources python3-pip ninja-build libcurl4-openssl-dev libssl-dev libpulse-dev
sudo apt purge cmake
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get --quiet update --yes && sudo -E apt-get --quiet install --yes cmake
- name: Install golang
uses: actions/setup-go@v4
with:
go-version: '1.20.7'
- name: Build RTME resources
run: |
bash setup/linux.sh
- name: Prepare docker resources for upload
if: github.ref_type == 'tag'
run: |
zip -r docker-resource.zip build_docker_dir/
- name: Upload docker resources
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v3
with:
name: docker-resource
path: docker-resource.zip
retention-days: 1
# Add the docker image to the release
docker-release-artifact:
if: github.ref_type == 'tag'
runs-on: ubuntu-20.04
needs: build-resources
permissions:
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download docker resources
uses: actions/download-artifact@v3
with:
name: docker-resource
- name: Build, save and release docker
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
unzip docker-resource.zip && rm docker-resource.zip
sudo bash setup/linux.sh --build_docker ${{ env.DOCKER_IMAGE_NAME }} ${GITHUB_REF_NAME} --skip_building
sudo chmod 777 dolbyio_rtme-${GITHUB_REF_NAME}.tar.gz
gh release upload ${GITHUB_REF_NAME} dolbyio_rtme-${GITHUB_REF_NAME}.tar.gz
docker-ghcr-publish:
if: github.ref_type == 'tag'
runs-on: ubuntu-20.04
needs: build-resources
permissions:
packages: write
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download docker resources
uses: actions/download-artifact@v3
with:
name: docker-resource
- name: Prepare docker sources
run: |
unzip docker-resource.zip && rm docker-resource.zip
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.GHCR }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.GHCR }}/${{ env.DOCKER_IMAGE_NAME }}
tags: ${{ github.ref_name }}
- name: Build and publish docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Disable this job for now until repo is set
docker-hub-publish:
if: false
runs-on: ubuntu-20.04
needs: build-resources
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Download docker resources
uses: actions/download-artifact@v3
with:
name: docker-resource
- name: Prepare docker sources
run: |
unzip docker-resource.zip && rm docker-resource.zip
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: ${GITHUB_REF_NAME}
- name: Build and publish docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}