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

chore: script to help with publishing next Tact versions on NPM #554

Merged
merged 3 commits into from
Jul 11, 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
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"

Loading