Skip to content
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

Allow spec_version increment skipping during version-bump execution #977

Merged
merged 4 commits into from
Jun 5, 2024
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
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.PHONY: version-bump

# usage: > type=patch make version-bump
# usage: > type=minor make version-bump
# usage: > type=major make version-bump
# * Usage Examples:*
# type=patch make version-bump
# type=minor make version-bump
# type=major make version-bump
# ** skip increment spec_version in substrate-node/runtime/src/lib.rs **
# type=patch retain_spec_version=1 make version-bump
version-bump:
set -e; \
if [ "$(type)" = "patch" ] || [ "$(type)" = "minor" ] || [ "$(type)" = "major" ]; then \
Expand All @@ -13,10 +16,13 @@ version-bump:
branch_name="$$default_branch-bump-version-to-$$new_version"; \
git checkout -b $$branch_name; \
current_spec_version=$$(sed -n -e 's/^.*spec_version: \([0-9]\+\),$$/\1/p' substrate-node/runtime/src/lib.rs); \
echo "Current spec_version: $$current_spec_version"; \
new_spec_version=$$((current_spec_version + 1)); \
echo "New spec_version: $$new_spec_version"; \
sed -i "s/spec_version: $$current_spec_version,/spec_version: $$new_spec_version,/" substrate-node/runtime/src/lib.rs; \
if [ -z "$${retain_spec_version}" ]; then \
current_spec_version=$$(sed -n -e 's/^.*spec_version: \([0-9]\+\),$$/\1/p' substrate-node/runtime/src/lib.rs); \
echo "Current spec_version: $$current_spec_version"; \
new_spec_version=$$((current_spec_version + 1)); \
echo "New spec_version: $$new_spec_version"; \
sed -i "s/spec_version: $$current_spec_version,/spec_version: $$new_spec_version,/" substrate-node/runtime/src/lib.rs; \
fi; \
jq ".version = \"$$new_version\"" activation-service/package.json > temp.json && mv temp.json activation-service/package.json; \
jq ".version = \"$$new_version\"" clients/tfchain-client-js/package.json > temp.json && mv temp.json clients/tfchain-client-js/package.json; \
jq ".version = \"$$new_version\"" scripts/package.json > temp.json && mv temp.json scripts/package.json; \
Expand All @@ -30,7 +36,11 @@ version-bump:
sed -i "s/^appVersion: .*/appVersion: '$$new_version'/" activation-service/helm/tfchainactivationservice/Chart.yaml; \
cd substrate-node && cargo metadata -q 1> /dev/null && cd ..; \
git add substrate-node/Cargo.toml substrate-node/Cargo.lock substrate-node/charts/substrate-node/Chart.yaml bridge/tfchain_bridge/chart/tfchainbridge/Chart.yaml activation-service/helm/tfchainactivationservice/Chart.yaml activation-service/package.json clients/tfchain-client-js/package.json scripts/package.json tools/fork-off-substrate/package.json substrate-node/runtime/src/lib.rs; \
git commit -m "Bump version to $$new_version (spec v$$new_spec_version)"; \
if [ -z "$${new_spec_version}" ]; then \
git commit -m "Bump version to $$new_version"; \
else \
git commit -m "Bump version to $$new_version (spec v$$new_spec_version)"; \
fi \
else \
echo "Invalid version type. Please use patch, minor, or major."; \
fi
6 changes: 5 additions & 1 deletion docs/production/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ This function will take care also of branch and commit creation.
Review the changes and push them, then follow the steps 3 and 4 below to finish the release.

Important: This function will also incrment the spec version in the runtime.
If you already did this in another commit you need to undo spec_version changes to avoid double incrment.
If you already did this in another commit or you don't need to do this, you can instruct the Makefile version-bump function to skip it by setting the `retain_spec_version` variable to 1 or any other value.

```bash
type=patch retain_spec_version=1 make version-bump
```

### Manually

Expand Down
Loading