Skip to content

Commit

Permalink
Release v0.4.0 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav committed Aug 15, 2021
2 parents f7ec5cf + f340f69 commit 9332539
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 71 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.14.x
go-version: 1.16.x

- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -55,10 +55,12 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.14.x
go-version: 1.16.x

- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Load cached dependencies
uses: actions/cache@v1
Expand All @@ -68,9 +70,24 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Prepare release
run: |
set -eou pipefail
VERSION=${{ github.ref }}
VERSION="${VERSION#refs/tags/}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Releasing $VERSION"
echo "Release notes:"
echo "----"
go run ./scripts/extract_changelog.go "$VERSION" | tee changes.$VERSION.txt
echo "----"
- name: Release
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist --release-notes changes.${{ env.VERSION }}.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GOBIN="$(pwd)/bin" go install github.com/tcnksm/ghr
PATH="$(pwd)/bin:$PATH" ./scripts/release.sh ${{ github.ref }}
GORELEASER_CURRENT_TAG: ${{ env.VERSION }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
vendor
/.tmp
/bin
/dist
/changes.*.txt
28 changes: 28 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
- ./scripts/check-version.sh {{.Version}}
builds:
- main: ./cmd/restack
binary: restack
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incminor .Tag }}-dev"
changelog:
# A commit log is not a changelog.
skip: true
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Releases
========

v0.4.0 (unreleased)
v0.4.0 (2021-08-15)
-------------------

- Simplify command line argument parsing.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ archive and put the binaries somewhere on your `$PATH`.

For example, if you have `$HOME/bin` on your `$PATH`,

OS=$(go env GOOS)
ARCH=$(go env GOARCH)
VERSION=v0.3.1
URL="https://github.com/abhinav/restack/releases/download/$VERSION/restack.$VERSION.$OS.$ARCH.tar.gz"
curl -L "$URL" | tar xzv -C ~/bin
OS=$(uname -s)
ARCH=$(uname -m)
VERSION=v0.4.0
URL="https://github.com/abhinav/restack/releases/download/$VERSION/restack_${VERSION}_${OS}_${ARCH}.tar.gz"
curl -L "$URL" | tar xzv -C ~/bin restack

Build From Source
-----------------

If you have Go installed, you can install `restack` using the following
command.

$ go get -u github.com/abhinav/restack/cmd/restack
$ go install github.com/abhinav/restack/cmd/restack@latest

Setup
=====
Expand Down
20 changes: 20 additions & 0 deletions scripts/check-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

version="${1:-}"
if [[ -z "$version" ]]; then
echo >&2 "usage: $0 VERSION"
exit 1
fi

got=$(grep '^const Version = ".*"' version.go | cut -d'"' -f2)

if [[ "$got" == "$version" ]]; then
exit 0
fi

echo >&2 "version.go mismatch:"
echo >&2 " want: $version"
echo >&2 " got: $got"
exit 1
58 changes: 0 additions & 58 deletions scripts/release.sh

This file was deleted.

2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ package restack
// Note that semantic versioning in this repository applies to the `restack`
// executable, not to its library components. These APIs may break at any
// time without warning.
const Version = "0.3.1"
const Version = "0.4.0"

0 comments on commit 9332539

Please sign in to comment.