Skip to content

Commit

Permalink
Change docker version release logic, refine image tags
Browse files Browse the repository at this point in the history
Signed-off-by: oguzkaganozt <[email protected]>
  • Loading branch information
oguzkaganozt committed Feb 14, 2024
1 parent 1fa5c2b commit 2200d57
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 28 deletions.
30 changes: 12 additions & 18 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/docker-build-and-push-main-self-hosted.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/docker-build-and-push-main.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 2200d57

Please sign in to comment.