Skip to content

Commit

Permalink
update example dates from release process
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Aug 5, 2019
1 parent 58fba35 commit 8787fca
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
14 changes: 13 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@

set -e # always immediately exit upon error

cd "`dirname $0`/.." # start in project root


read -p "Do you want to update the example dates? (y/N): " yn

if [[ "$yn" == "y" ]]
then
./scripts/update-example-dates.sh
fi


npm run ci
npm run archive


# after version script completes, will call postversion hook, which calls `monorepo publish`
npx monorepo version
# ^after it completes, will call postversion hook, which calls `monorepo publish`
39 changes: 39 additions & 0 deletions scripts/require-clean-working-tree.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

# Exits with an error code of there are any uncomitted changes. Derived from:
# http://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes

# optional argument
working_subdir="$1"

# git complains if empty string path in statements below
if [[ -z "$working_subdir" ]]
then
working_subdir="."
fi

# Update the index
git update-index -q --refresh
err=0

# Disallow unstaged changes in the working tree
if ! git diff-files --quiet -- "$working_subdir"
then
echo >&2 "You have unstaged changes."
git diff-files --name-status -r -- "$working_subdir" >&2
err=1
fi

# Disallow uncommitted changes in the index
if ! git diff-index --cached --quiet HEAD --
then
echo >&2 "Your index contains uncommitted changes."
git diff-index --cached --name-status -r HEAD -- >&2
err=1
fi

if [ $err = 1 ]
then
echo >&2 "Please commit or stash them."
exit 1
fi
10 changes: 4 additions & 6 deletions scripts/update-example-dates.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env bash

# always immediately exit upon error
set -e
set -e # always immediately exit upon error

# start in project root
cd "`dirname $0`/.."
cd "`dirname $0`/.." # start in project root

./bin/require-clean-working-tree.sh examples
./scripts/require-clean-working-tree.sh examples

read -p "Enter new year (4 digits): " year
read -p "Enter new month (2 digits): " month
Expand All @@ -25,6 +23,6 @@ find examples -type f \( -name '*.html' -o -name '*.json' \) -print0 \

# build the commit
git add examples
git commit --quiet -m "updated demo dates"
git commit --quiet -m "updated example dates"

echo "Success."

0 comments on commit 8787fca

Please sign in to comment.