Skip to content

Commit db85c53

Browse files
authored
ci: use the latest OBS in Docker image (#133)
* Get latest OBS from their workflow instead of using PPA * path context so the deb is available for the build * ci: build image when obs websocket protocol version is bumped instead of weekly
1 parent 1f3e25c commit db85c53

File tree

6 files changed

+54
-7
lines changed

6 files changed

+54
-7
lines changed

.github/workflows/image.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Image
22

33
on:
44
workflow_dispatch:
5-
schedule: [{cron: '25 9 * * 3'}] # 9:25 on Wednesdays
65
push:
76
branches: [main]
87
paths:
@@ -16,6 +15,11 @@ jobs:
1615
build:
1716
runs-on: ubuntu-latest
1817
steps:
18+
- uses: actions/checkout@v4
19+
- run: ./script/get-latest-obs.sh docker/obs.deb
20+
env:
21+
GITHUB_TOKEN: ${{ github.token }}
22+
1923
- uses: docker/setup-buildx-action@v3
2024
- uses: docker/login-action@v3
2125
with:
@@ -24,7 +28,7 @@ jobs:
2428
password: ${{ secrets.GITHUB_TOKEN }}
2529
- uses: docker/build-push-action@v5
2630
with:
27-
context: "{{ defaultContext }}:docker"
31+
context: ./docker
2832
push: true
2933
cache-from: type=registry,ref=${{ env.image }}:buildcache
3034
cache-to: type=registry,ref=${{ env.image }}:buildcache,mode=max

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
cover*.out
22
cover*.html
33
example.png
4+
docker/*.deb

docker/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*
22
!config
33
!cmd.sh
4+
!*.deb

docker/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
FROM ubuntu:latest AS build
22
ENV DEBIAN_FRONTEND noninteractive
3-
RUN apt-config dump | grep -E 'Install-(Recommends|Suggests)' | sed s/1/0 | tee /etc/apt/apt.conf.d/999norecommend
43
RUN apt-get update -y
5-
RUN apt-get install -y software-properties-common
6-
RUN add-apt-repository -y ppa:obsproject/obs-studio
7-
RUN apt-get update -y
8-
RUN apt-get install -y obs-studio
4+
COPY *.deb /tmp/obs.deb
5+
RUN dpkg -i /tmp/obs.deb || :
6+
RUN apt-get install -y --fix-broken
7+
RUN apt-get install -y qt6-wayland qt6-qpa-plugins
98
RUN apt-get install -y xvfb x11vnc
109
RUN apt-get install -y netcat
1110
RUN rm -rf /var/lib/apt/lists/*

script/bump-protocol-version.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ compare_versions() {
5656
echo "$next" >/tmp/.goobs.protocol.next
5757
}
5858

59+
build_image() {
60+
if [ -z "$CI" ]; then return; fi
61+
gh workflow run image.yml
62+
sleep 3
63+
id=$(gh run list --workflow image.yml --event workflow_dispatch --json databaseId --jq 'first|.databaseId')
64+
gh run watch "$id" --interval 10
65+
}
66+
5967
bump_versions() {
6068
sed -i "s/$current/$next/g" version.go README.md
6169
make generate
@@ -65,6 +73,7 @@ bump_versions() {
6573
main() {
6674
find_versions
6775
compare_versions
76+
build_image
6877
bump_versions
6978
}
7079

script/get-latest-obs.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
main() {
4+
path=${1?specify where you want the deb}
5+
6+
download_artifact >/tmp/obs.zip
7+
rm -rf /tmp/obs
8+
unzip -od /tmp/obs /tmp/obs.zip
9+
mv /tmp/obs/*.deb "$path"
10+
ls -al "$path"
11+
}
12+
13+
download_artifact() {
14+
repo=obsproject/obs-studio
15+
id=$(gh api /repos/$repo/actions/artifacts --jq '
16+
[
17+
.artifacts[]
18+
| select(
19+
.workflow_run.head_branch == "master" and
20+
(.name|contains("ubuntu")) and
21+
(.name|contains("dbgsym")|not)
22+
)
23+
]
24+
| sort_by(.created_at)
25+
| reverse
26+
| first
27+
| .id
28+
')
29+
gh api "/repos/$repo/actions/artifacts/$id/zip"
30+
}
31+
32+
set -eu
33+
main "$@"

0 commit comments

Comments
 (0)