From 09d86fdaadd39ba5784c924c5718e8d71c10f205 Mon Sep 17 00:00:00 2001 From: s3rj1k Date: Tue, 25 Jun 2024 19:20:27 +0200 Subject: [PATCH] Add optional `ref` parameter to `cicd-docker-build-and-distribute` workflow. --- .github/actions/docker-build-artifacts/action.yml | 2 ++ .../workflows/cicd-docker-build-and-distribute.yml | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/actions/docker-build-artifacts/action.yml b/.github/actions/docker-build-artifacts/action.yml index 026b0131..9a15868b 100644 --- a/.github/actions/docker-build-artifacts/action.yml +++ b/.github/actions/docker-build-artifacts/action.yml @@ -57,6 +57,8 @@ runs: --secret id=DEPLOYMENT_TOKEN,env=DEPLOYMENT_TOKEN \ --tag artifacts-${GITHUB_RUN_ID}:${GITHUB_SHA} \ --ulimit nofile=1024000:1024000 \ + --force-rm \ + --pull \ . 2>&1 | tee -a ${{ inputs.BUILD_LOG_FILENAME }} - name: Extract artifacts from image diff --git a/.github/workflows/cicd-docker-build-and-distribute.yml b/.github/workflows/cicd-docker-build-and-distribute.yml index 49fc0c32..62df026d 100644 --- a/.github/workflows/cicd-docker-build-and-distribute.yml +++ b/.github/workflows/cicd-docker-build-and-distribute.yml @@ -3,6 +3,10 @@ name: Build and Distribute (via Docker) on: workflow_call: inputs: + REF: + required: false + description: The branch, tag or SHA to checkout + type: string ENVIRONMENT: required: false type: string @@ -104,10 +108,18 @@ jobs: id-token: write environment: ${{ inputs.ENVIRONMENT }} steps: - - name: Checkout code + if: ${{ inputs.REF == '' }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: ${{ inputs.CODE_WORKING_DIRECTORY }} + + - name: Checkout code by REF + if: ${{ inputs.REF != '' }} uses: actions/checkout@v4 with: + ref: ${{ inputs.REF }} fetch-depth: 0 path: ${{ inputs.CODE_WORKING_DIRECTORY }}