Sha256: 24b6b5c10c7983fe43e930c70258303521eabd2ac91f774243bcdd24cfb0bf30

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

#!/usr/bin/env bash

PATH="./bin:$PATH"

echo "=> Fetching latest jq"
wget -O bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x bin/jq
which jq
jq --version

./bin/sync

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

git_status=$(git status 2> /dev/null | tr "\\n" " ")

if [[ "$git_status" =~ "nothing to commit" ]]; then
  echo "No changes detected. Skipping new packages."
  exit
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 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"
git push --tags

echo "=> Check repo status"
git diff
git diff-index --cached HEAD
git status

echo "=> Generate gem package"
mkdir -p ~/.gem
echo ":rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
chmod 0600 ~/.gem/credentials
mkdir -p pkg
rm -rf pkg/*.gem
email_data_gem=pkg/email_data-$version.gem
gem build email_data.gemspec --silent --output $email_data_gem
gem push $email_data_gem

echo "=> Generate npm package"
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
chmod 0600 ~/.npmrc
npm publish --access public

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
email_data-1607560144.0.0 bin/package
email_data-1607473695.0.0 bin/package
email_data-1607452424.0.0 bin/package