@@ -64,11 +64,73 @@ ci_cargo_deny:
6464
6565alias deny := ci_cargo_deny
6666
67- ci_semver_updates :
68- cargo + stable --locked generate-lockfile
69-
70- semver_updates :
71- cargo + stable generate-lockfile
72-
7367ci_typo :
7468 typos
69+
70+ release TYPE :
71+ #!/usr/bin/env bash
72+ set -e
73+ git fetch
74+ CURRENT_BRANCH=$(git branch --show-current)
75+ if [ " $CURRENT_BRANCH" != " main" ]; then
76+ echo " Not on main branch. Aborting."
77+ exit 1
78+ fi
79+ if [ " $(git rev-parse HEAD)" != " $(git rev-parse origin/main)" ]; then
80+ echo " Local main is not up to date with origin/main. Aborting."
81+ exit 1
82+ fi
83+ echo " Starting {{ TYPE}} release process..."
84+ just update_dependencies
85+ cargo fmt
86+ CURRENT_VERSION=$(grep ' ^version = ' Cargo.toml | head -1 | sed ' s/version = "\(.*\)"/\1/' )
87+ IFS=' .' read -r MAJOR MINOR PATCH <<< " $CURRENT_VERSION"
88+ case {{ TYPE}} in
89+ patch)
90+ NEW_PATCH=$((PATCH + 1 ))
91+ NEW_VERSION=" $MAJOR.$MINOR.$NEW_PATCH"
92+ ;;
93+ minor)
94+ NEW_MINOR=$((MINOR + 1 ))
95+ NEW_VERSION=" $MAJOR.$NEW_MINOR.0"
96+ ;;
97+ major)
98+ NEW_MAJOR=$((MAJOR + 1 ))
99+ NEW_VERSION=" $NEW_MAJOR.0.0"
100+ ;;
101+ *)
102+ echo " Invalid type: {{ TYPE}} . Use patch, minor, or major."
103+ exit 1
104+ ;;
105+ esac
106+ echo " Bumping version from $CURRENT_VERSION to $NEW_VERSION"
107+ sed -i " s/version = \" $CURRENT_VERSION\" /version = \" $NEW_VERSION\" /" Cargo.toml
108+ cd frontend
109+ npx playwright test --update-snapshots all
110+ cd ..
111+ git add .
112+ while true ; do
113+ read -p " Please check the new snapshots and any other changes. Continue with commit? (y/N/s for shell) " -n 1 -r REPLY
114+ echo
115+ case $REPLY in
116+ [Yy])
117+ break
118+ ;;
119+ [Nn])
120+ echo " Release aborted."
121+ exit 1
122+ ;;
123+ [Ss])
124+ echo " Dropping into subshell ($SHELL). Type 'exit' to return."
125+ $SHELL || true
126+ ;;
127+ *)
128+ echo " Invalid input. Please enter y, n, or s."
129+ ;;
130+ esac
131+ done
132+
133+ git commit -m " Create Release $NEW_VERSION" -m " Automated release tasks performed:" -m " - Updated dependencies" -m " - Formatted code with cargo fmt" -m " - Bumped version to $NEW_VERSION" -m" - Updated Playwright snapshots"
134+ git tag " $NEW_VERSION"
135+ git push origin refs/ heads/ main --tags
136+ echo " {{ TYPE}} release $NEW_VERSION completed successfully!"
0 commit comments