Skip to content

Commit 8d8c636

Browse files
committed
ci: Use the new tool to get the mike version information
This means we use new aliases: `next` becomes `v0.x-dev`. Pre-releases will get a version too (for example `v0.7-pre`). The `latest` version now correctly points to the bigger stable version, and new aliases are added for the latest pre-release (`latest-pre`) and development branch (`latest-dev`). Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 9f5ebdc commit 8d8c636

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -314,39 +314,12 @@ jobs:
314314
- name: Calculate and check version
315315
id: mike-version
316316
env:
317-
REF: ${{ github.ref }}
318-
REF_NAME: ${{ github.ref_name }}
319-
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
317+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
318+
GITHUB_REPO: ${{ github.repository }}
319+
GIT_REF: ${{ github.ref }}
320+
GIT_SHA: ${{ github.sha }}
320321
run: |
321-
aliases=
322-
version=
323-
if test "$REF_NAME" = "$DEFAULT_BRANCH"
324-
then
325-
version=next
326-
# A tag that starts with vX.Y or X.Y
327-
elif echo "$REF" | grep -q '^refs/tags' && echo "$REF_NAME" | grep -Pq '^v?\d+\.\d+\.'
328-
then
329-
if echo "$REF_NAME" | grep -Pq -- "-" # pre-release
330-
then
331-
echo "::notice title=Documentation was not published::" \
332-
"The tag '$REF_NAME' looks like a pre-release."
333-
exit 0
334-
fi
335-
version=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+\.[0-9]+)\..*$/\1/') # vX.Y
336-
major=$(echo "$REF_NAME" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX
337-
default_major=$(echo "$DEFAULT_BRANCH" | sed -r 's/^(v?[0-9]+)\..*$/\1/') # vX
338-
aliases=$major
339-
if test "$major" = "$default_major"
340-
then
341-
aliases="$aliases latest"
342-
fi
343-
else
344-
echo "::warning title=Documentation was not published::" \
345-
"Don't know how to handle '$REF' to make 'mike' version."
346-
exit 0
347-
fi
348-
echo "version=$version" >> $GITHUB_OUTPUT
349-
echo "aliases=$aliases" >> $GITHUB_OUTPUT
322+
python -m frequenz.repo.config.cli.version.mike.info
350323
351324
- name: Fetch sources
352325
if: steps.mike-version.outputs.version

0 commit comments

Comments
 (0)