Skip to content

Commit

Permalink
feat: add versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
serafdev committed May 5, 2024
1 parent 2f283d0 commit c51fac2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
run: |
echo "$(git describe --tags)"
echo "version=$(git describe --tags)" >> "$GITHUB_OUTPUT"
./tools/bump_version.sh "$(git describe --tags)"
git add ./internal/version/version.go
git add ./README.md
git commit -m "Bump version to $(git describe --tags) [skip ci]"
releases-matrix:
needs: release
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

# Masjid's Droid
# Masjid's Droid v2.0.10

<img src="./assets/img/fares___blueprint.png" width="512" alt="M-Droid Blueprint"/>

Expand Down
3 changes: 3 additions & 0 deletions internal/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package version

const RobotVersion = "v2.0.10"
25 changes: 25 additions & 0 deletions tools/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# Bump the version number in ./internal/version/version.go
# Usage: ./tools/bump_version.sh "v1.0.0"

set -e

CURRENT_VERSION=$(grep -oP 'const RobotVersion = "\K[^"]+' internal/version/version.go)
echo "Current version: $CURRENT_VERSION"

if [ -z "$1" ]; then
echo "Usage: ./tools/bump_version.sh \"v1.0.0\""
exit 1
fi

if [ "$CURRENT_VERSION" == "$1" ]; then
echo "Version $1 is the same as the current version"
exit 1
fi

echo "Bumping version to $1 in internal/version/version.go"
sed -i "s/const RobotVersion = \"$CURRENT_VERSION\"/const RobotVersion = \"$1\"/" internal/version/version.go

echo "Bumping version to $1 in README.md"
sed -i "s/# Masjid's Droid $CURRENT_VERSION/# Masjid's Droid $1/" README.md

0 comments on commit c51fac2

Please sign in to comment.