From 6ff8c89246e5b9891f86bbeb90dac0031a4fa246 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 20 Jun 2022 08:08:03 -0700 Subject: [PATCH] Move to the Eartlhy job for the nightly Docker build. Closes #1953 --- .github/workflows/docker-nightly-earthly.yaml | 40 ------------------- .github/workflows/docker-nightly.yaml | 26 +++++++++--- build/release/docker-nightly-earthly.sh | 14 ------- build/release/docker-nightly.sh | 21 ++-------- 4 files changed, 24 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/docker-nightly-earthly.yaml delete mode 100755 build/release/docker-nightly-earthly.sh diff --git a/.github/workflows/docker-nightly-earthly.yaml b/.github/workflows/docker-nightly-earthly.yaml deleted file mode 100644 index 46a647b6d..000000000 --- a/.github/workflows/docker-nightly-earthly.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# 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: - - uses: earthly/actions-setup@v1 - with: - version: 'latest' # or pin to an specific version, e.g. "v0.6.10" - - - 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 - - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v1 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - uses: actions/checkout@v3 - - name: Checkout and build - if: env.GH_CR_PAT != null - env: - GH_CR_PAT: ${{ secrets.GH_CR_PAT }} - run: cd build/release && ./docker-nightly-earthly.sh diff --git a/.github/workflows/docker-nightly.yaml b/.github/workflows/docker-nightly.yaml index de8bf99c7..cc686f270 100644 --- a/.github/workflows/docker-nightly.yaml +++ b/.github/workflows/docker-nightly.yaml @@ -1,24 +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 * * *" + - cron: '0 2 * * *' jobs: Docker: runs-on: ubuntu-latest steps: + - uses: earthly/actions-setup@v1 + with: + version: 'latest' # or pin to an specific version, e.g. "v0.6.10" + + - name: Earthly version + run: earthly --version - name: Log into GitHub Container Registry - env: + 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 + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v1 + with: + image: tonistiigi/binfmt:latest + platforms: all + - uses: actions/checkout@v3 - - name: Setup and run - env: + - name: Checkout and build + if: env.GH_CR_PAT != null + env: GH_CR_PAT: ${{ secrets.GH_CR_PAT }} run: cd build/release && ./docker-nightly.sh - if: env.GH_CR_PAT != null diff --git a/build/release/docker-nightly-earthly.sh b/build/release/docker-nightly-earthly.sh deleted file mode 100755 index 82d00a2d4..000000000 --- a/build/release/docker-nightly-earthly.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/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}..." - -# Change to the root directory of the repository -cd $(git rev-parse --show-toplevel) - -earthly --ci --push +docker-all --image="ghcr.io/owncast/${DOCKER_IMAGE}" --tag=nightly --version="${VERSION}" diff --git a/build/release/docker-nightly.sh b/build/release/docker-nightly.sh index 3ccfaa15f..990ea5c1d 100755 --- a/build/release/docker-nightly.sh +++ b/build/release/docker-nightly.sh @@ -1,29 +1,14 @@ +#!/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" DATE=$(date +"%Y%m%d") VERSION="${DATE}-nightly" -GIT_COMMIT=$(git rev-list -1 HEAD) - -# Create production build of Tailwind CSS -pushd ../../build/javascript >> /dev/null -# Install the tailwind & postcss CLIs -npm install --quiet --no-progress -# Run the tailwind CLI and pipe it to postcss for minification. -# Save it to a temp directory that we will reference below. -NODE_ENV="production" ./node_modules/.bin/tailwind build | ./node_modules/.bin/postcss > "../../webroot/js/web_modules/tailwindcss/dist/tailwind.min.css" -popd echo "Building Docker image ${DOCKER_IMAGE}..." # Change to the root directory of the repository cd $(git rev-parse --show-toplevel) -# Docker build -docker build --build-arg NAME=docker --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=$GIT_COMMIT -t ghcr.io/owncast/${DOCKER_IMAGE}:nightly . - -# Dockerhub -# You must be authenticated via `docker login` with your Dockerhub credentials first. -# docker push gabekangas/owncast:nightly - -docker push ghcr.io/owncast/${DOCKER_IMAGE}:nightly \ No newline at end of file +earthly --ci --push +docker-all --image="ghcr.io/owncast/${DOCKER_IMAGE}" --tag=nightly --version="${VERSION}"