Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion fishjam_protos/mix.exs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
defmodule FishjamProtos.MixProject do
use Mix.Project

@release_version "0.4.0"

def project do
[
app: :fishjam_protos,
version: "0.4.0",
version: @release_version,
elixir: "~> 1.17",
start_permanent: Mix.env() == :prod,
elixirc_paths: ["lib"],
Expand Down
52 changes: 52 additions & 0 deletions release-automation/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
set -e

# Usage: ./bump-version.sh <version>
VERSION="$1"
MIX_EXS="mix.exs"
README="README.md"

if [ -z "$VERSION" ]; then
echo "Usage: $0 <version>"
exit 1
fi

# Navigate to fishjam_protos directory
cd fishjam_protos

BRANCH_NAME="release-$VERSION"
git checkout -b "$BRANCH_NAME"

if [ ! -f "$MIX_EXS" ]; then
echo "Error: $MIX_EXS not found in repo root"
exit 1
fi

# Search and replace `@release_version "<version>"` to new version
if grep -q "@release_version" "$MIX_EXS"; then
sed -i.bak -E 's/(@release_version[[:space:]]*")[^"]*/\1'"$VERSION"'/' "$MIX_EXS"
rm -f "$MIX_EXS.bak"
else
echo "Error: @release_version line not found in $MIX_EXS"
exit 1
fi

# Confirm replacement: accept either a literal version string or the module attribute
if grep -q "@release_version \"$VERSION\"" "$MIX_EXS"; then
echo "Updated $MIX_EXS to $VERSION"
else
echo "Error: Failed to update version in $MIX_EXS via regex"
exit 1
fi

# Update version in README.md if present
if [ -f "$README" ]; then
sed -i.bak -E "s/:fishjam_protos, \"~> [0-9]+\.[0-9]+\.[0-9]+\"/:fishjam_protos, \"~> $VERSION\"/" "$README"
rm -f "$README.bak"
echo "Updated $README to version $VERSION"
else
echo "⚠️ $README not found, skipping README version update"
fi

echo "✅ Version bump complete for $VERSION"
echo "BRANCH_NAME:$BRANCH_NAME"
Loading