Skip to content

Commit

Permalink
Prepare for first real release
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonk committed Oct 2, 2021
1 parent fc4c624 commit e4e852b
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/.env
/coverage
/dev/mock-curl-output.json
/dev/*.tgz
/dev/inform-slack/**
/test-results.tap
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog #

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][changelog], and this project
adheres to [Semantic Versioning][semver].

[changelog]: https://keepachangelog.com/en/1.0.0/
[semver]: https://semver.org/spec/v2.0.0.html

## [Unreleased]

## [v1.0.0] - 2021-10-01

- First actual release

[Unreleased]: https://github.com/jasonk/inform-slack/compare/v1.0.0...HEAD
[v1.0.0]: https://github.com/jasonk/inform-slack/releases/tag/v1.0.0
52 changes: 52 additions & 0 deletions dev/make-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"

REPO="https://github.com/jasonk/inform-slack"

warn() { echo "$@" 1>&2; }
die() { warn "$@"; exit 1; }

# Executable Version
EV="$(../bin/inform-slack --version)"
# Changelog Info
CI="$(grep -E '^## \[v([0-9\.]+)\]' ../CHANGELOG.md | head -1 | tr -d '\[\]#')"
# Changelog Version
CV="$(awk '{print $1}' <<<"$CI")"
# Changelog Date
CD="$(awk '{print $3}' <<<"$CI")"
# Today's Date
TD="$(date +%F)"

if [ "$TD" != "$CD" ]; then
die "Today is $TD, but latest Changelog entry is $CD"
fi
if [ "$CV" != "$EV" ]; then
die "Executable version is $EV, but Changelog version is $CV"
fi

UR="$(grep -E '^\[Unreleased\]:' ../CHANGELOG.md)"
if [ -z "$UR" ]; then die "No [Unreleased] URL in CHANGELOG"; fi
if [ "$(basename "$UR")" != "${EV}...HEAD" ]; then
die "Wrong [Unreleased] URL in CHANGELOG";
fi

if ! grep -qE "^\[$EV\]: $REPO/releases/tag/$EV$" ../CHANGELOG.md; then
die "No [$EV] tag in CHANGELOG";
fi

if git rev-parse -q --verify "refs/tags/$EV" >/dev/null; then
die "Version $EV is already tagged, did you remember to increment it?"
fi

if [ -n "$(git status --porcelain=v1 2>/dev/null)" ]; then
die "The repo has uncommitted changes"
fi

git tag -a "$EV" -m ":shipit: Release $EV"
git push origin "$EV"

rm -rf inform-slack
mkdir inform-slack
cp -a ../*.md ../LICENSE ../bin ../builders ../lib inform-slack
tar cvfz "inform-slack-${EV}.tgz" inform-slack
gh release create "$EV" "inform-slack-${EV}.tgz"
3 changes: 3 additions & 0 deletions lib/inform-slack.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
# https://github.com/jasonk/inform-slack

export INFORM_SLACK_VERSION="v1.0.0"

# Defaults
: ${INFORM_SLACK_UNFURL_LINKS:=false}
: ${INFORM_SLACK_UNFURL_MEDIA:=false}
Expand Down Expand Up @@ -319,6 +321,7 @@ inform_slack() {
case "$1" in
# Option Flags
-h|--help) usage ; exit ;;
-V|--version) echo "$INFORM_SLACK_VERSION" ; exit ;;
-l|--list-builders) list-builders ; exit ;;
-H|--help-builder) shift 1 ; help-builder "$1" ; exit ;;
-n|--dry-run)
Expand Down

0 comments on commit e4e852b

Please sign in to comment.