From db2efda130ca72d18a1fb688f95500c6062edbba Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Mon, 11 Nov 2019 15:03:10 -0800 Subject: [PATCH] Handle tagging as part of release script --- Makefile | 2 +- README.md | 8 +++++--- release.sh | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2b32ec67..ce2101bb 100644 --- a/Makefile +++ b/Makefile @@ -2,4 +2,4 @@ build: go build -o doppler main.go release: - doppler run -- ./release.sh + doppler run -- ./release.sh $(VERSION) diff --git a/README.md b/README.md index db5db1af..c707c239 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,14 @@ Test building for all targets: ### Release +To release a new version, run: + ``` -git tag -a vX.Y.Z -m "The release message" -git push --tags -GITHUB_TOKEN=$(doppler secrets get GITHUB_TOKEN --plain) goreleaser release --rm-dist +make release VERSION=vX.Y.Z ``` +This command will push local changes to Origin, create a new tag, and push the tag to Origin. It will then build and release the doppler binaries. + Note: The release will automatically fail if the tag and HEAD have diverged ` тип release failed after 0.13s error=git tag v0.0.2 was not made against commit c9c6950d18790c17db11fedae331a226f8f12c6b` diff --git a/release.sh b/release.sh index 6ae07142..9fbb28ca 100755 --- a/release.sh +++ b/release.sh @@ -1,10 +1,26 @@ #!/bin/bash function finish { - rm "$GOOGLE_APPLICATION_CREDENTIALS" + rm -f "$GOOGLE_APPLICATION_CREDENTIALS" } trap finish EXIT +if [ $# -eq 0 ]; then + echo "You must specify a version" + exit 1 +fi + +TAGNAME=$1 +if [ "${TAGNAME:0:1}" != "v" ]; then + echo "Version is incorrect; must match format vX.Y.Z" + exit 1 +fi + +echo "Using version $TAGNAME" + +git tag -a "$TAGNAME" -m "$TAGNAME" +git push origin "$TAGNAME" + echo "$GOOGLE_CREDS" > "$GOOGLE_APPLICATION_CREDENTIALS" goreleaser release --rm-dist scripts/publish-deb.sh