Skip to content

Commit

Permalink
Fix release look up
Browse files Browse the repository at this point in the history
  • Loading branch information
makaimann committed Feb 20, 2025
1 parent 8beec63 commit 41105de
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/write-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,43 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get release version

- name: Get current release version
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
# Attempt to get the most recent tag
if ! VERSION=$(git describe --tags --abbrev=0 2>/dev/null); then
echo "Error: No tags found in the repository"
exit 1
fi
# Validate that the version looks reasonable (optional)
if ! echo "$VERSION" | grep -qE '^v?[0-9]+\.[0-9]+\.[0-9]+'; then
echo "Warning: Tag '$VERSION' doesn't match expected version format"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update VERSION file
run: |
echo "${{ steps.get_version.outputs.version }}" > VERSION
- name: Commit and push if changed
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add VERSION
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "chore: Update VERSION file to ${{ steps.get_version.outputs.version }}"
git push

0 comments on commit 41105de

Please sign in to comment.