Skip to content

Image

Image #107

Workflow file for this run

---
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"