-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add release workflow + improve image builds #19
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 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1a9920c
feat: add release workflow + improve image builds
sanbotto 28ce905
Fix VERSION file checks
sanbotto 830cd2c
Make sure new version is greater
sanbotto 9a5498f
Update actions version
sanbotto 19890ea
Pre-releases only get a single tag
sanbotto 9fe538b
Add explicit error context for git tag operations
sanbotto f16b0b2
Refactor version comparison logic in workflows to use shared action
sanbotto 317f888
Simplify run conditions
sanbotto 95276d0
Improve prerelease detection
sanbotto f510df3
Add missing id
sanbotto aee8bd0
Update action version
sanbotto 4fb990f
Fix indentation
sanbotto 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,93 @@ | ||
| name: "Compare semantic versions" | ||
| description: "Compares two semantic versions (with optional v-prefix, pre-release, and build metadata) and returns gt/lt/eq." | ||
|
|
||
| inputs: | ||
| v1: | ||
| description: "First version to compare (e.g., v1.2.3, 1.2.3-rc1)" | ||
| required: true | ||
| v2: | ||
| description: "Second version to compare (e.g., v1.2.3, 1.2.3-rc1)" | ||
| required: true | ||
|
|
||
| outputs: | ||
| result: | ||
| description: "Comparison result: gt (v1 > v2), lt (v1 < v2), eq (v1 == v2)" | ||
| value: ${{ steps.compare.outputs.result }} | ||
| exit_code: | ||
| description: "Numeric comparison code: 0 (v1 > v2), 1 (v1 < v2), 2 (v1 == v2)" | ||
| value: ${{ steps.compare.outputs.exit_code }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Compare versions | ||
| id: compare | ||
| shell: bash | ||
| run: | | ||
| v1="${{ inputs.v1 }}" | ||
| v2="${{ inputs.v2 }}" | ||
|
|
||
| # Function to compare semantic versions | ||
| version_compare() { | ||
| local v1=$1 | ||
| local v2=$2 | ||
|
|
||
| # Remove 'v' prefix | ||
| v1=${v1#v} | ||
| v2=${v2#v} | ||
|
|
||
| # Remove pre-release and build metadata for comparison | ||
| v1_clean=${v1%%-*} | ||
| v1_clean=${v1_clean%%+*} | ||
| v2_clean=${v2%%-*} | ||
| v2_clean=${v2_clean%%+*} | ||
|
|
||
| # Split into major.minor.patch | ||
| IFS='.' read -ra V1_PARTS <<< "$v1_clean" | ||
| IFS='.' read -ra V2_PARTS <<< "$v2_clean" | ||
|
|
||
| # Compare major | ||
| if [ "${V1_PARTS[0]}" -gt "${V2_PARTS[0]}" ]; then | ||
| return 0 # v1 > v2 | ||
| elif [ "${V1_PARTS[0]}" -lt "${V2_PARTS[0]}" ]; then | ||
| return 1 # v1 < v2 | ||
| fi | ||
|
|
||
| # Compare minor | ||
| if [ "${V1_PARTS[1]}" -gt "${V2_PARTS[1]}" ]; then | ||
| return 0 # v1 > v2 | ||
| elif [ "${V1_PARTS[1]}" -lt "${V2_PARTS[1]}" ]; then | ||
| return 1 # v1 < v2 | ||
| fi | ||
|
|
||
| # Compare patch | ||
| if [ "${V1_PARTS[2]}" -gt "${V2_PARTS[2]}" ]; then | ||
| return 0 # v1 > v2 | ||
| elif [ "${V1_PARTS[2]}" -lt "${V2_PARTS[2]}" ]; then | ||
| return 1 # v1 < v2 | ||
| fi | ||
|
|
||
| return 2 # v1 == v2 | ||
| } | ||
|
|
||
| version_compare "$v1" "$v2" | ||
| compare_rc=$? | ||
|
|
||
| case "$compare_rc" in | ||
| 0) | ||
| result="gt" | ||
| ;; | ||
| 1) | ||
| result="lt" | ||
| ;; | ||
| 2) | ||
| result="eq" | ||
| ;; | ||
| *) | ||
| echo "Unexpected comparison result code: $compare_rc" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| echo "result=$result" >> "$GITHUB_OUTPUT" | ||
| echo "exit_code=$compare_rc" >> "$GITHUB_OUTPUT" |
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
Oops, something went wrong.
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.