From 569afc13e8ff1b20e0d37a2f95a52c9c2f2db459 Mon Sep 17 00:00:00 2001 From: flounder5 <25795672+flounder5@users.noreply.github.com> Date: Thu, 14 Dec 2023 16:33:31 -0500 Subject: [PATCH] Makefile cleanup. Fix pipeline. --- .github/workflows/workflow-build.yml | 6 +++--- Makefile | 17 +++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/workflow-build.yml b/.github/workflows/workflow-build.yml index 6bc8942..40bf649 100644 --- a/.github/workflows/workflow-build.yml +++ b/.github/workflows/workflow-build.yml @@ -24,12 +24,12 @@ jobs: - name: Docker build branch run: make docker - if: ${{ github.ref_type == 'branch' }} + if: ${{ github.ref_type == 'branch' && github.ref_name != 'main' }} - name: Docker build main - run: make docker ARGS="-t latest" + run: make docker_main if: ${{ github.ref_type == 'branch' && github.ref_name == 'main' }} - name: Docker build tag - run: make docker ARGS="-t ${{github.ref_name}}" + run: make docker_tag TAG="${{github.ref_name}}" if: ${{ github.ref_type == 'tag' }} diff --git a/Makefile b/Makefile index 1f0fdc6..2264d48 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ INIT_CMD=git submodule update --init --recursive ANALYZE_CMD=cd ./src && find . -name '*.sh' | xargs shellcheck -x && \ cd ../test/unit && find . -name '*.sh' | xargs shellcheck -x UNIT_TEST_CMD=cd ./test/unit && ./test.sh +DOCKER_BUILD_BRANCH_CMD=./src/dockerBuild.sh dockerBuildStandardBranch -e ${DOCKER_REGISTRY} -r ${DOCKER_REPO} ${ARGS} +DOCKER_BUILD_MAIN_CMD=./src/dockerBuild.sh dockerBuildStandardMain -e ${DOCKER_REGISTRY} -r ${DOCKER_REPO} ${ARGS} +DOCKER_BUILD_TAG_CMD=./src/dockerBuild.sh dockerBuildStandardTag ${TAG} -e ${DOCKER_REGISTRY} -r ${DOCKER_REPO} ${ARGS} DOCKER_REGISTRY=index.docker.io/flounder5 @@ -22,7 +25,7 @@ BUILDER_RUN_CMD=${BUILDER_PULL_CMD} && \ DOCKER_REPO=builder-docker -.PHONY: init analyze analyze_local unit_test unit_test_local docker +.PHONY: init analyze analyze_local unit_test unit_test_local docker docker_main docker_tag init: ${INIT_CMD} @@ -42,11 +45,13 @@ unit_test_local: #To prevent the circular dependency, this repo calls the dockerBuild script directly # instead of through the builder-docker image. docker: - ./src/dockerBuild.sh \ - dockerBuildStandardBranch \ - -e ${DOCKER_REGISTRY} \ - -r ${DOCKER_REPO} \ - ${ARGS} + ${DOCKER_BUILD_BRANCH_CMD} + +docker_main: + ${DOCKER_BUILD_MAIN_CMD} + +docker_tag: + .${DOCKER_BUILD_TAG_CMD} #Everything right of the pipe is order-only prerequisites. all: | init analyze unit_test docker