From 353bec3fca8fd1468b4e8c73a7399e81b701def4 Mon Sep 17 00:00:00 2001 From: Camden Narzt Date: Thu, 18 Jul 2024 10:37:46 -0600 Subject: [PATCH] simplify ci workflow drop schedule merge edge & pr jobs upload artifacts rather than publish to ghcr --- .github/workflows/dockerimage-ci.yml | 42 ++++++---------------------- Makefile | 8 +++++- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/.github/workflows/dockerimage-ci.yml b/.github/workflows/dockerimage-ci.yml index 380a1b3..ba07904 100644 --- a/.github/workflows/dockerimage-ci.yml +++ b/.github/workflows/dockerimage-ci.yml @@ -3,8 +3,6 @@ name: Docker Image CI on: create: workflow_dispatch: - schedule: - - cron: '15 05 * * 1' # Late night for the Americas, early morning for Europe pull_request: paths-ignore: - '**.md' @@ -35,34 +33,7 @@ jobs: build_pr: name: "Test Build Docker images" - if: github.event_name == 'pull_request' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - strategy: - matrix: - arch: - - 'amd64' - - 'arm64' - env: - OWNER: '${{ github.repository_owner }}' - steps: - - uses: actions/checkout@v4 - - name: Set lower case repository owner name - run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV" - - name: Enable docker multiarch - uses: docker/setup-qemu-action@v3 - - name: Fix docker logs - uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - env.BUILDKIT_STEP_LOG_MAX_SIZE=-1 - env.BUILDKIT_STEP_LOG_MAX_SPEED=-1 - default-load=true - - name: Build the Docker images - run: make DISABLE_OPTIMIZATIONS=1 "OWNER=$OWNER_LC" build_{{matrix.arch}} - - build_edge: - name: "Build edge Docker images" - if: github.event_name != 'create' && github.event_name != 'pull_request' && github.event_name != 'schedule' + if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || ( github.event_name != 'create' && github.event_name != 'pull_request' && github.event_name != 'schedule' ) runs-on: ubuntu-latest strategy: matrix: @@ -91,9 +62,14 @@ jobs: env.BUILDKIT_STEP_LOG_MAX_SPEED=-1 default-load=true - name: Build the Docker images - run: make "OWNER=$OWNER_LC" VERSION=edge build_{{matrix.arch}} - - name: Push the Docker images - run: make "OWNER=$OWNER_LC" VERSION=edge push_{{matrix.arch}} + run: make DISABLE_OPTIMIZATIONS=1 "OWNER=$OWNER_LC" build_{{matrix.arch}} + - name: Export image + run: make "OWNER=$OWNER_LC" export_{{matrix.arch}} + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: docker_image_{{matrix.arch}} + path: *.tar build_release: name: "Build release Docker images" diff --git a/Makefile b/Makefile index 2ca4532..46316f7 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ OWNER = phusion DISABLE_OPTIMIZATIONS = 0 IMAGE = $(IMG_REPO)/$(OWNER)/holy-build-box -.PHONY: build_amd64 test_amd64 tags_amd64 push_amd64 build_arm64 test_arm64 tags_arm64 push_arm64 release +.PHONY: build_amd64 test_amd64 tags_amd64 push_amd64 build_arm64 test_arm64 tags_arm64 push_arm64 export_amd64 export_arm64 release build_amd64: docker buildx build --load --platform "linux/amd64" --rm -t $(IMAGE):$(VERSION)-amd64 --pull --build-arg DISABLE_OPTIMIZATIONS=$(DISABLE_OPTIMIZATIONS) . @@ -51,6 +51,12 @@ ifdef MAJOR_VERSION docker push $(IMAGE):latest-arm64 endif +export_amd64: tags_amd64 + docker save -o hbb_amd64.tar $(IMAGE):$(VERSION)-amd64 + +export_arm64: tags_arm64 + docker save -o hbb_arm64.tar $(IMAGE):$(VERSION)-arm64 + release: push_amd64 push_arm64 docker manifest create $(IMAGE):$(VERSION) $(IMAGE):$(VERSION)-amd64 $(IMAGE):$(VERSION)-arm64 docker manifest push $(IMAGE):$(VERSION)