From 2200d57cb5d16c58524814958ed3f40fb01d50c8 Mon Sep 17 00:00:00 2001 From: oguzkaganozt Date: Wed, 14 Feb 2024 21:26:21 +0300 Subject: [PATCH] Change docker version release logic, refine image tags Signed-off-by: oguzkaganozt --- .../actions/docker-build-and-push/action.yaml | 30 ++++++++----------- ...ocker-build-and-push-main-self-hosted.yaml | 11 +++---- .../workflows/docker-build-and-push-main.yaml | 11 +++---- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 1e35918d91e..54a57ce7f8a 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -27,21 +27,16 @@ runs: sudo apt-get -y install jq shell: bash - # workflow_dispatch: latest, date - # schedule: latest, date - # tag: semver + # workflow_dispatch: latest, release_version + # schedule: date - name: Set Docker tags id: set-docker-tags run: | tags=() - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - tags+=("latest") - tags+=("{{date 'YYYYMMDD'}}") + if [ "${{ github.event_name }}" == "workflow_dispatch" and -n "${{ inputs.release_version }}"]; then + tags+=("${{ inputs.release_version }}") else - tags+=("type=schedule,pattern=latest") - tags+=("type=schedule,pattern={{date 'YYYYMMDD'}}") - tags+=("type=semver,pattern={{version}}") - tags+=("type=match,pattern=\d+.\d+") + tags+=("{{date 'YYYYMMDD'}}") fi # Output multiline strings: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings @@ -59,9 +54,9 @@ runs: tags: ${{ steps.set-docker-tags.outputs.tags }} bake-target: docker-metadata-action-prebuilt flavor: | - latest=false - prefix=${{ inputs.tag-prefix }} - suffix=prebuilt${{ inputs.tag-suffix }} + latest=true + suffix=-prebuilt${{ inputs.tag-suffix }} + - name: Docker meta for devel id: meta-devel @@ -71,9 +66,9 @@ runs: tags: ${{ steps.set-docker-tags.outputs.tags }} bake-target: docker-metadata-action-devel flavor: | - latest=false - prefix=${{ inputs.tag-prefix }} - suffix=devel${{ inputs.tag-suffix }} + latest=true + suffix=-devel${{ inputs.tag-suffix }} + - name: Docker meta for runtime id: meta-runtime @@ -83,8 +78,7 @@ runs: tags: ${{ steps.set-docker-tags.outputs.tags }} bake-target: docker-metadata-action-runtime flavor: | - latest=false - prefix=${{ inputs.tag-prefix }} + latest="${{ github.event_name }}" == "workflow_dispatch" and -n "${{ inputs.release_version }}" suffix=-runtime${{ inputs.tag-suffix }} - name: Login to GitHub Container Registry diff --git a/.github/workflows/docker-build-and-push-main-self-hosted.yaml b/.github/workflows/docker-build-and-push-main-self-hosted.yaml index 4e9faf33d31..246e210203f 100644 --- a/.github/workflows/docker-build-and-push-main-self-hosted.yaml +++ b/.github/workflows/docker-build-and-push-main-self-hosted.yaml @@ -1,10 +1,6 @@ name: docker-build-and-push-main-self-hosted on: - push: - tags: - - v* - - "[0-9]+.[0-9]+*" schedule: - cron: 0 0 1,15 * * workflow_dispatch: @@ -14,6 +10,11 @@ on: required: true default: false type: boolean + release_version: + description: 'Release version(If it is a release, specify the tag name for it)' + required: false + default: '' + type: string jobs: docker-build-and-push-main-self-hosted: @@ -33,7 +34,7 @@ jobs: - name: cuda base_image_env: base_image lib_dir: aarch64 - additional-tag-suffix: -cuda-debug + additional-tag-suffix: -cuda steps: # https://github.com/actions/checkout/issues/211 - name: Change permission of workspace diff --git a/.github/workflows/docker-build-and-push-main.yaml b/.github/workflows/docker-build-and-push-main.yaml index 8a24cefc6c7..80e068791fa 100644 --- a/.github/workflows/docker-build-and-push-main.yaml +++ b/.github/workflows/docker-build-and-push-main.yaml @@ -1,10 +1,6 @@ name: docker-build-and-push-main on: - push: - tags: - - v* - - "[0-9]+.[0-9]+*" schedule: - cron: 0 0 1,15 * * workflow_dispatch: @@ -14,6 +10,11 @@ on: required: true default: false type: boolean + release_version: + description: 'Release version(If it is a release, specify the tag name for it)' + required: false + default: '' + type: string jobs: docker-build-and-push-main: @@ -33,7 +34,7 @@ jobs: - name: cuda base_image_env: base_image lib_dir: x86_64 - additional-tag-suffix: -cuda-debug + additional-tag-suffix: -cuda steps: - name: Check out repository uses: actions/checkout@v4