-
Notifications
You must be signed in to change notification settings - Fork 450
PMM-13881: Use VERSION file for exporter version tag #1094
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8f400c8
set up VERSION file
idoqo b23ce3a
add new line
idoqo c0e9ce1
bump version described in version file
idoqo 33fd845
simply version checks
idoqo bc88597
Merge branch 'main' into PMM-13881-mongodb-exporter-version
idoqo 2ce594e
Merge branch 'main' into PMM-13881-mongodb-exporter-version
idoqo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,75 @@ | ||
| name: Version Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| version-check: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Get version from VERSION file | ||
| id: file-version | ||
| run: | | ||
| if [ -f "VERSION" ]; then | ||
| FILE_VERSION=$(cat VERSION | tr -d '\n\r ') | ||
| echo "version=$FILE_VERSION" >> $GITHUB_OUTPUT | ||
| echo "VERSION file contains: $FILE_VERSION" | ||
| else | ||
| echo "VERSION file not found!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Get version from git tag | ||
| id: git-version | ||
| run: | | ||
| GIT_VERSION=$(git describe --tags --abbrev=0 --always) | ||
| echo "version=$GIT_VERSION" >> $GITHUB_OUTPUT | ||
| echo "Git tag version: $GIT_VERSION" | ||
|
|
||
| - name: Install semver comparison tool | ||
| run: | | ||
| npm install -g semver | ||
|
|
||
| - name: Compare versions | ||
| run: | | ||
| FILE_VERSION="${{ steps.file-version.outputs.version }}" | ||
| GIT_VERSION="${{ steps.git-version.outputs.version }}" | ||
|
|
||
| echo "Comparing versions:" | ||
| echo " VERSION file: $FILE_VERSION" | ||
| echo " Git tag: $GIT_VERSION" | ||
|
|
||
| # Remove 'v' prefix if present for comparison | ||
| FILE_VERSION_CLEAN=$(echo "$FILE_VERSION" | sed 's/^v//') | ||
| GIT_VERSION_CLEAN=$(echo "$GIT_VERSION" | sed 's/^v//') | ||
|
|
||
| # Check if versions are valid semver | ||
| if ! semver "$FILE_VERSION_CLEAN" >/dev/null 2>&1; then | ||
| echo "ERROR: VERSION file contains invalid semantic version: $FILE_VERSION" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! semver "$GIT_VERSION_CLEAN" >/dev/null 2>&1; then | ||
| echo "ERROR: Git tag contains invalid semantic version: $GIT_VERSION" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Compare versions: -1 if first < second, 0 if equal, 1 if first > second | ||
| COMPARISON=$(semver -r ">=$GIT_VERSION_CLEAN" "$FILE_VERSION_CLEAN" && echo "valid" || echo "invalid") | ||
|
|
||
| if [ "$COMPARISON" = "invalid" ]; then | ||
| echo "VERSION file ($FILE_VERSION) is behind git tag ($GIT_VERSION)" | ||
| echo "The VERSION file must be ahead of or equal to the latest git tag." | ||
| exit 1 | ||
| else | ||
| echo "VERSION file ($FILE_VERSION) is ahead of or equal to git tag ($GIT_VERSION)" | ||
| fi | ||
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
| v0.45.0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.