Skip to content

Commit

Permalink
Merge pull request #3 from weaviate/jose/get-latest
Browse files Browse the repository at this point in the history
Add new composite action to retrieve latest weaviate version
  • Loading branch information
jfrancoa authored Nov 22, 2024
2 parents bb4903a + d5e76d5 commit f04b7ab
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/actions/get-latest-weaviate-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: get-latest-weaviate-version
description: 'Retrieves the latest Weaviate version from GitHub releases'
outputs:
latest_weaviate_version:
description: 'The latest Weaviate version'
value: ${{ steps.get-version.outputs.weaviate_version }}
runs:
using: 'composite'
steps:
- name: Get latest Weaviate version
id: get-version
shell: bash
run: |
LATEST_RELEASE=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/semi-technologies/weaviate.git | cut -d/ -f3 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+$' | cut -c 2- | tail -1)
echo "weaviate_version=${LATEST_RELEASE}" >> "${GITHUB_OUTPUT}"
68 changes: 68 additions & 0 deletions .github/workflows/latest-version-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test Get Latest Weaviate Version Action

on:
push:

jobs:
version-format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Test get-latest-weaviate-version action
id: latest-version
uses: ./.github/actions/get-latest-weaviate-version

- name: Verify version format
run: |
VERSION=${{ steps.latest-version.outputs.latest_weaviate_version }}
if ! [[ $VERSION =~ ^[1-9]\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format: $VERSION"
echo "Expected format: X.Y.Z where X≥1"
exit 1
fi
version-comparison:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Test get-latest-weaviate-version action
id: latest-version
uses: ./.github/actions/get-latest-weaviate-version

- name: Compare with minimum version
run: |
VERSION=${{ steps.latest-version.outputs.latest_weaviate_version }}
MIN_VERSION="1.0.0"
if ! [[ "$(printf '%s\n' "$MIN_VERSION" "$VERSION" | sort -V | tail -n1)" = "$VERSION" ]]; then
echo "Retrieved version ($VERSION) is lower than minimum expected version ($MIN_VERSION)"
exit 1
fi
version-stability:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: First version check
id: version-1
uses: ./.github/actions/get-latest-weaviate-version

- name: Second version check
id: version-2
uses: ./.github/actions/get-latest-weaviate-version

- name: Verify version stability
run: |
VERSION1=${{ steps.version-1.outputs.latest_weaviate_version }}
VERSION2=${{ steps.version-2.outputs.latest_weaviate_version }}
if [ "$VERSION1" != "$VERSION2" ]; then
echo "Version mismatch between consecutive checks:"
echo "First check: $VERSION1"
echo "Second check: $VERSION2"
exit 1
fi

0 comments on commit f04b7ab

Please sign in to comment.