bin/package in email_data-1607565761.0.0 vs bin/package in email_data-1607653226.0.0
- old
+ new
@@ -1,34 +1,46 @@
#!/usr/bin/env bash
PATH="./bin:$PATH"
+os=$(uname)
echo "=> Fetching latest jq"
-wget -O bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
+
+if [[ "$os" = "Darwin" ]]; then
+ jq_url=https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64
+else
+ jq_url=https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
+fi
+
+wget -O bin/jq $jq_url
chmod +x bin/jq
which jq
jq --version
./bin/sync
-git_status=$(git status 2> /dev/null | tr "\\n" " ")
-
-if [[ "$git_status" =~ "nothing to commit" ]]; then
+if `git status | grep -q "nothing to commit"`; then
echo "No changes detected. Skipping new packages."
exit
fi
echo "=> Updating version files"
version=$(date "+%s")
package_json=$(cat package.json | jq --arg version "${version}.0.0" '.version = $version')
echo $package_json | jq > package.json
-sed -i -E "s/[0-9.]+/${version}.0.0/" ./lib/email_data/version.rb
+if [[ "$os" = "Darwin" ]]; then
+ sed -i "" -E "s/[0-9.]+/${version}.0.0/" ./lib/email_data/version.rb
+else
+ sed -i -E "s/[0-9.]+/${version}.0.0/" ./lib/email_data/version.rb
+fi
+
git config user.email "me@fnando.com"
git config user.name "Nando Vieira via Github Actions"
git add Gemfile.lock
git add package.json
git add lib/email_data/version.rb
+git add data/*.txt
git commit --message "Bump up version (v${version}.0.0)."
git reset --hard
git pull origin --rebase
git push origin --set-upstream
git tag "v${version}.0.0"