Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Add nightly build action that uses Earthly. Another step in #1953

Gabe Kangas5a3a610d7c92
diff --git a/.github/workflows/docker-nightly-earthly.yaml b/.github/workflows/docker-nightly-earthly.yaml
new file mode 100644
index 0000000000..e1bdb662f0
--- /dev/null
+++ b/.github/workflows/docker-nightly-earthly.yaml
@@ -0,0 +1,40 @@
+# See https://docs.earthly.dev/ci-integration/vendor-specific-guides/gh-actions-integration
+# for details.
+
+name: Build nightly docker
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '0 2 * * *'
+
+jobs:
+ Docker:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Download latest earthly
+ run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.14/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
+
+ - name: Earthly version
+ run: earthly --version
+
+ - name: Log into GitHub Container Registry
+ env:
+ GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
+ run: echo "${{ secrets.GH_CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
+ if: env.GH_CR_PAT != null
+
+ - uses: actions/checkout@v3
+ - name: Checkout and build
+ if: env.GH_CR_PAT != null
+ env:
+ GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
+ run: |
+ branch=""
+ if [ -n "$GITHUB_HEAD_REF" ]; then
+ branch="$GITHUB_HEAD_REF"
+ else
+ branch="${GITHUB_REF##*/}"
+ fi
+ git checkout -b "$branch" || true
+ cd build/release && ./docker-nightly-earthly.sh
diff --git a/build/release/docker-nightly-earthly.sh b/build/release/docker-nightly-earthly.sh
new file mode 100755
index 0000000000..523d797204
--- /dev/null
+++ b/build/release/docker-nightly-earthly.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Docker build
+# Must authenticate first: https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages
+DOCKER_IMAGE="owncast-earthly"
+DATE=$(date +"%Y%m%d")
+VERSION="${DATE}-nightly"
+
+echo "Building Docker image ${DOCKER_IMAGE}..."
+
+earthly --ci --push +docker --image="ghcr.io/owncast/${DOCKER_IMAGE}" --tag=nightly --version=${VERSION}
+
+# docker push ghcr.io/owncast/${DOCKER_IMAGE}:nightly