-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from getditto/dhm/convenience-release-scripts
Add convenience release scripts
- Loading branch information
Showing
7 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Script to cargo publish a new version of safer-ffi | ||
|
||
set -euo pipefail | ||
cd "$(git rev-parse --show-toplevel)" | ||
|
||
(set -x | ||
git status >&2 | ||
) | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo >&2 "❌ Uncommitted changes detected." | ||
false | ||
fi | ||
|
||
current_version="$(sed -nE 's/^version = "(.*)"\s*# Keep in sync.*/\1/p' src/proc_macro/Cargo.toml)" | ||
(set -x | ||
current_version="${current_version}" | ||
) | ||
|
||
echo -n "Version desired? [${current_version}] " | ||
read -r desired_version | ||
|
||
set -x | ||
desired_version="${desired_version:-$current_version}" | ||
{ set +x; } 2>/dev/null | ||
|
||
(set -x | ||
./scripts/change_version.sh "${desired_version}" | ||
) | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
git add -u | ||
(set -x | ||
git commit -m "Version \`${desired_version}\` release" | ||
) | ||
fi | ||
(set -x | ||
git push | ||
) | ||
|
||
PACKAGES=( | ||
src/proc_macro/ | ||
./ | ||
) | ||
for package in "${PACKAGES[@]}"; do | ||
(set -x | ||
cd "${package}" | ||
cargo publish | ||
) | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Script to bump the `safer-ffi` version of the repo (both in `.toml` and `.lock` files). | ||
|
||
set -euo pipefail | ||
cd "$(git rev-parse --show-toplevel)" | ||
|
||
usage() { | ||
cat >&2 <<-EOF | ||
Usage: | ||
${0} <new version number> | ||
Current version: | ||
${0} $(sed -nE 's/^version = "(.*)"\s*# Keep in sync.*/\1/p' src/proc_macro/Cargo.toml) | ||
EOF | ||
false | ||
} | ||
|
||
new_version="${1:?$(usage)}" | ||
|
||
PACKAGES=( | ||
Cargo.toml | ||
src/proc_macro/Cargo.toml | ||
) | ||
|
||
for package in "${PACKAGES[@]}"; do | ||
( | ||
set -x | ||
sed -i.bak -E 's/^version = "(=?)(.*)"(\s*# Keep in sync)/version = "\1'"${new_version}"'"\3/' "${package}" | ||
) | ||
rm "${package}".bak | ||
done | ||
|
||
find . -type f -name 'Cargo.lock' -print0 \ | ||
| while IFS= read -r -d '' lockfile; do | ||
dir="$(dirname ${lockfile})" | ||
( | ||
set -x | ||
cd "${dir}" && cargo update -vw | ||
) | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters