Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update docker tags 🐳 #4347

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions .github/workflows/_24_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,23 @@ jobs:
run: |
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
echo "time=$(date +'%H:%M:%S')" >> "$GITHUB_OUTPUT"

get-version-from-branch-name:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout 🏁
uses: actions/checkout@v3
- name: Get version from branch name
id: version
run: |
version=$(./ci/scripts/extract_version.sh ${{ github.ref }})
echo "Extracted version: $version"
if [[ "$version" == "" ]]; then
echo "version=0.0.0" >> "$GITHUB_OUTPUT"
else
echo "version=$version" >> "$GITHUB_OUTPUT"
fi
set-dockerfile-name:
runs-on: ubuntu-22.04
outputs:
Expand All @@ -54,7 +70,7 @@ jobs:
fi

private-images:
needs: [get-date-time, set-dockerfile-name]
needs: [get-date-time, set-dockerfile-name, get-version-from-branch-name]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -98,7 +114,8 @@ jobs:
type=raw,value=${{ github.sha }}
type=raw,value=${{ inputs.network }}
type=ref,event=branch
type=ref,event=tag
type=ref,event=tag,prefix=${{ inputs.network }}-
type=raw,value=${{ needs.get-version-from-branch-name.outputs.version }},prefix=${{ inputs.network }}-,enable=${{ needs.get-version-from-branch-name.outputs.version != '0.0.0' }}
type=ref,event=pr

- name: Login to Github Container Registry 🔑
Expand Down Expand Up @@ -140,7 +157,7 @@ jobs:

public-images:
if: inputs.publish_public_images || inputs.save_tags != ''
needs: [get-date-time, set-dockerfile-name]
needs: [get-date-time, set-dockerfile-name, get-version-from-branch-name]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -181,7 +198,8 @@ jobs:
type=raw,value=${{ github.sha }}
type=raw,value=${{ inputs.network }}
type=ref,event=branch
type=ref,event=tag
type=ref,event=tag,prefix=${{ inputs.network }}-
type=raw,value=${{ needs.get-version-from-branch-name.outputs.version }},prefix=${{ inputs.network }}-,enable=${{ needs.get-version-from-branch-name.outputs.version != '0.0.0' }}
type=ref,event=pr

- name: Login to DockerHub 🔑
Expand Down
20 changes: 15 additions & 5 deletions ci/scripts/extract_version.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/usr/bin/env bash

# Remove any prefixes like "v" from the tag
tag="${1#v}"
# Input string
input_string="$1"

# Extract major and minor version using cut command
version=$(echo "$tag" | cut -d. -f1,2)
# Regular expression to match version pattern (X.Y.Z or X.Y)
# This pattern looks for numbers separated by dots.
# The -E flag is used for extended regex, and -o to output only the matched part.
version=$(echo "$input_string" | grep -Eo '[0-9]+\.[0-9]+(\.[0-9]+)?')

# Check if a version was found
if [[ -z "$version" ]]; then
exit 0
fi

# Extract major and minor version
major_minor=$(echo "$version" | cut -d. -f1,2)

# Output the major and minor version
echo "$version"
echo "$major_minor"