#!/bin/bash set -x if git diff --name-only HEAD..HEAD^ | egrep -q '^VERSION$'; then # The VERSION file changed in the last commit, build the gem and push gem build *.gemspec gem push *.gem # We set the GITHUB_TOKEN variable from the repo's 'Secrets' admin panel. git remote set-url --push origin https://JackDanger:${GITHUB_TOKEN}@github.com/JackDanger/permanent_records.git version=$(cat VERSION) git tag ${version} git push origin ${version} fi