-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from weaviate/jose/get-latest
Add new composite action to retrieve latest weaviate version
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |