Skip to content

Commit 03976ed

Browse files
authored
Merge pull request #4150 from esune/fix/lts-release-cicd
fix(ci): use correct python version per LTS release when tagging images
2 parents e5e070c + 731f9c1 commit 03976ed

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

.github/lts-versions.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# LTS Version Patterns
22
# Each line represents a version pattern that should be treated as LTS
3-
# Use major.minor format (e.g., 1.2 for versions 1.2.x)
3+
# Format: major.minor:python_version (e.g., 1.2:3.12 for versions 1.2.x built with Python 3.12)
44
# Lines starting with # are comments and will be ignored
55
# Empty lines are ignored
66

7-
# Example: Uncomment the lines below to enable LTS for specific versions
8-
1.3
9-
1.6
10-
11-
# For testing purposes (remove in production):
12-
# 0.0
7+
1.3:3.12
8+
1.6:3.13

.github/workflows/tag-recreate-lts.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
outputs:
2929
lts_tag: ${{ steps.set_outputs.outputs.lts_tag }}
3030
release_tag: ${{ steps.set_outputs.outputs.release_tag }}
31+
python_version: ${{ steps.set_outputs.outputs.python_version }}
3132

3233
steps:
3334
- name: Checkout repository
@@ -94,24 +95,36 @@ jobs:
9495
fi
9596
9697
# Read LTS versions from config file (remove comments and empty lines)
97-
LTS_VERSIONS=$(grep -v '^#' .github/lts-versions.txt | grep -v '^$' | tr '\n' '|' | sed 's/|$//')
98+
# Format: major.minor:python_version
99+
LTS_ENTRIES=$(grep -v '^#' .github/lts-versions.txt | grep -v '^$')
98100
99-
if [ -z "$LTS_VERSIONS" ]; then
101+
if [ -z "$LTS_ENTRIES" ]; then
100102
echo "No LTS versions configured in .github/lts-versions.txt"
101103
echo "skip=true" >> "$GITHUB_OUTPUT"
102104
exit 0
103105
fi
104106
105-
echo "Configured LTS versions: $LTS_VERSIONS"
107+
echo "Configured LTS entries: $LTS_ENTRIES"
106108
echo "Checking release: $RELEASE_TAG"
107109
108110
# Extract major.minor from release tag
109111
SHORT_TAG=$(echo "$RELEASE_TAG" | cut -d. -f1,2)
110112
111-
# Check if it matches any LTS version pattern
112-
if echo "$SHORT_TAG" | grep -qE "^($LTS_VERSIONS)$"; then
113-
echo "Release $RELEASE_TAG matches LTS version $SHORT_TAG"
113+
# Check if it matches any LTS version pattern and extract python version
114+
PYTHON_VERSION=""
115+
while IFS= read -r entry; do
116+
LTS_VER=$(echo "$entry" | cut -d: -f1)
117+
PY_VER=$(echo "$entry" | cut -d: -f2)
118+
if [ "$SHORT_TAG" == "$LTS_VER" ]; then
119+
PYTHON_VERSION="$PY_VER"
120+
break
121+
fi
122+
done <<< "$LTS_ENTRIES"
123+
124+
if [ -n "$PYTHON_VERSION" ]; then
125+
echo "Release $RELEASE_TAG matches LTS version $SHORT_TAG (python $PYTHON_VERSION)"
114126
echo "skip=false" >> "$GITHUB_OUTPUT"
127+
echo "python_version=$PYTHON_VERSION" >> "$GITHUB_OUTPUT"
115128
else
116129
echo "Release $RELEASE_TAG (version $SHORT_TAG) is not configured as LTS"
117130
echo "skip=true" >> "$GITHUB_OUTPUT"
@@ -219,6 +232,7 @@ jobs:
219232
run: |
220233
echo "lts_tag=${{ steps.vars.outputs.LTS_TAG }}" >> "$GITHUB_OUTPUT"
221234
echo "release_tag=${{ steps.set_release_tag.outputs.release_tag }}" >> "$GITHUB_OUTPUT"
235+
echo "python_version=${{ steps.check_lts.outputs.python_version }}" >> "$GITHUB_OUTPUT"
222236
echo "Set job outputs for downstream job"
223237
224238
tag-lts-images:
@@ -232,7 +246,6 @@ jobs:
232246
packages: write
233247
strategy:
234248
matrix:
235-
python-version: ["3.12", "3.13"]
236249
image-name: ["acapy-agent", "acapy-agent-bbs"]
237250

238251
steps:
@@ -249,8 +262,8 @@ jobs:
249262

250263
- name: Tag Images with LTS
251264
env:
252-
SOURCE_TAG: py${{ matrix.python-version }}-${{ needs.recreate-lts-release.outputs.release_tag }}
253-
LTS_TAG: py${{ matrix.python-version }}-${{ needs.recreate-lts-release.outputs.lts_tag }}
265+
SOURCE_TAG: py${{ needs.recreate-lts-release.outputs.python_version }}-${{ needs.recreate-lts-release.outputs.release_tag }}
266+
LTS_TAG: py${{ needs.recreate-lts-release.outputs.python_version }}-${{ needs.recreate-lts-release.outputs.lts_tag }}
254267
IMAGE_NAME: ghcr.io/${{ steps.lower.outputs.owner }}/${{ matrix.image-name }}
255268
run: |
256269
echo "Tagging \"$IMAGE_NAME:$SOURCE_TAG\" with \"$LTS_TAG\""

0 commit comments

Comments
 (0)