Skip to content

Commit

Permalink
chore: script to help with publishing next Tact versions on NPM (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-trunov authored Jul 11, 2024
1 parent a159f6b commit 99c3063
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ jobs:
run: |
yarn knip
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: "./scripts"

- name: Check there are no errors to be fixed in package.json
run: |
npm pkg fix && git diff --exit-code
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"maxint",
"minmax",
"mintable",
"mktemp",
"multiformats",
"Korshakov",
"nocheck",
Expand Down
31 changes: 31 additions & 0 deletions scripts/set-next-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env sh

# Call the script with a new dev version as its argument.
# If the argument is not provided a new version will be
# automatically generated from package.json and current date,
# plus a gitHead field with the current Git commit hash
# will be added to package.json.
#
# The version format should be as follows:
# <MAJOR>.<MINOR>.<PATCH>-dev.<ISO-8601-DATE-WITHOUT-DELIMITERS>
# e.g. something like 1.4.0-dev.20240711

FILE=package.json
COMMIT=$(git rev-parse HEAD)

if [ ! -f "$FILE" ]; then
echo "Error: $FILE not found!"
exit 1
fi

VERSION=$1
if [ -z "$VERSION" ]; then
VERSION=$(jq -r '.version' $FILE)-dev.$(date +"%Y%m%d")
fi

TMP=$(mktemp)
jq ".version = \"$VERSION\" | .gitHead = \"$COMMIT\"" "$FILE" > "$TMP"
mv "$TMP" "$FILE"
rm "$TMP"
yarn prettier -w "$FILE"

0 comments on commit 99c3063

Please sign in to comment.