-
Notifications
You must be signed in to change notification settings - Fork 23
47 lines (43 loc) · 1.55 KB
/
image.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
---
name: Image
on:
workflow_dispatch:
schedule: [{ cron: "25 9 1,15 * *" }] # 9:25 on the 1st and 15th of the month
push:
branches: [main]
paths:
- docker/*
env:
image: ghcr.io/${{ github.repository }}
# https://docs.docker.com/build/ci/github-actions/examples/#registry-cache
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./script/get-latest-obs.sh docker/obs.deb
env:
GITHUB_TOKEN: ${{ github.token }}
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: ./docker
push: true
cache-from: type=registry,ref=${{ env.image }}:buildcache
cache-to: type=registry,ref=${{ env.image }}:buildcache,mode=max
tags: |
${{ env.image }}:latest
- name: Tag with OBS versions included in our image
run: |
docker pull ${{ env.image }}:latest
set -x
obs_version=$(docker run --rm ${{ env.image }}:latest obs --version | tr -dc '[0-9.]')
websocket_version=$(docker run --rm ${{ env.image }}:latest timeout 2s xvfb-run obs | grep -Po 'websocket.+Version: \K\d+\.\d+\.\d+')
version_tagged="${{ env.image }}:$obs_version-$websocket_version"
docker tag ${{ env.image }}:latest "$version_tagged"
docker push "$version_tagged"