-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically bump rust crate version on release
This way we don't forget to do it in future releases.
- Loading branch information
1 parent
be9371b
commit aed3c7d
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -27,3 +27,22 @@ jobs: | |
run: cargo publish --manifest-path fiat-rust/Cargo.toml | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.crates_io_token }} | ||
- name: Bump Rust crate version | ||
run: | | ||
etc/bump-fiat-rust-crate-version.sh | ||
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
git config http.sslVerify false | ||
git config user.name "Automated Publisher" | ||
git config user.email "[email protected]" | ||
git remote add publisher "${remote_repo}" | ||
git show-ref # useful for debugging | ||
git branch --verbose | ||
git checkout master | ||
git add fiat-rust/Cargo.toml | ||
timestamp=$(date -u) | ||
git commit -m "Automated Rust Crate Version Bump: ${timestamp} ${GITHUB_SHA}" | ||
git pull --rebase publisher master | ||
git push publisher master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
CARGO_TOML_PATH="fiat-rust/Cargo.toml" | ||
|
||
VERSION_LINE="$(grep 'version\s*=\s*' "${CARGO_TOML_PATH}")" | ||
VERSION_NUMBER="$(echo "${VERSION_LINE}" | sed 's/version\s*=\s*//g; s/"//g; s/\s//g')" | ||
# https://stackoverflow.com/a/4486087/377022 | ||
NEW_VERSION_NUMBER="$(awk -F. '/[0-9]+\./{$NF++;print}' OFS=. <<< "${VERSION_NUMBER}")" | ||
NEW_VERSION_LINE="$(echo "${VERSION_LINE}" | sed "s/${VERSION_NUMBER}/${NEW_VERSION_NUMBER}/g")" | ||
echo "Updating ${CARGO_TOML_PATH} from version ${VERSION_NUMBER} to ${NEW_VERSION_NUMBER}" | ||
sed "s/${VERSION_LINE}/${NEW_VERSION_LINE}/g" -i "${CARGO_TOML_PATH}" | ||
|
||
# sanity check | ||
AGAIN_VERSION_LINE="$(grep 'version\s*=\s*' "${CARGO_TOML_PATH}")" | ||
AGAIN_VERSION_NUMBER="$(echo "${AGAIN_VERSION_LINE}" | sed 's/version\s*=\s*//g; s/"//g; s/\s//g')" | ||
if [ "${NEW_VERSION_NUMBER}" != "${AGAIN_VERSION_NUMBER}" ]; then | ||
echo "ERROR: Tried to change '${VERSION_NUMBER}' to '${NEW_VERSION_NUMBER}' in ${CARGO_TOML_PATH}," | ||
echo " but somehow ended up with '${AGAIN_VERSION_NUMBER}'." | ||
exit 1 | ||
fi |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "fiat-crypto" | ||
version = "0.1.1" | ||
version = "0.1.2" | ||
authors = ["Fiat Crypto library authors <[email protected]>"] | ||
edition = "2018" | ||
description = "Fiat-crypto generated Rust" | ||
|