Skip to content

Commit 9332539

Browse files
committed
Release v0.4.0 (#21)
2 parents f7ec5cf + f340f69 commit 9332539

File tree

8 files changed

+80
-71
lines changed

8 files changed

+80
-71
lines changed

.github/workflows/go.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Go
1717
uses: actions/setup-go@v1
1818
with:
19-
go-version: 1.14.x
19+
go-version: 1.16.x
2020

2121
- name: Checkout code
2222
uses: actions/checkout@v2
@@ -55,10 +55,12 @@ jobs:
5555
- name: Setup Go
5656
uses: actions/setup-go@v1
5757
with:
58-
go-version: 1.14.x
58+
go-version: 1.16.x
5959

6060
- name: Checkout code
6161
uses: actions/checkout@v2
62+
with:
63+
fetch-depth: 0
6264

6365
- name: Load cached dependencies
6466
uses: actions/cache@v1
@@ -68,9 +70,24 @@ jobs:
6870
restore-keys: |
6971
${{ runner.os }}-go-
7072
73+
- name: Prepare release
74+
run: |
75+
set -eou pipefail
76+
VERSION=${{ github.ref }}
77+
VERSION="${VERSION#refs/tags/}"
78+
echo "VERSION=$VERSION" >> $GITHUB_ENV
79+
echo "Releasing $VERSION"
80+
echo "Release notes:"
81+
echo "----"
82+
go run ./scripts/extract_changelog.go "$VERSION" | tee changes.$VERSION.txt
83+
echo "----"
84+
7185
- name: Release
86+
uses: goreleaser/goreleaser-action@v2
87+
with:
88+
distribution: goreleaser
89+
version: latest
90+
args: release --rm-dist --release-notes changes.${{ env.VERSION }}.txt
7291
env:
7392
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
run: |
75-
GOBIN="$(pwd)/bin" go install github.com/tcnksm/ghr
76-
PATH="$(pwd)/bin:$PATH" ./scripts/release.sh ${{ github.ref }}
93+
GORELEASER_CURRENT_TAG: ${{ env.VERSION }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
vendor
22
/.tmp
33
/bin
4+
/dist
5+
/changes.*.txt

.goreleaser.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This is an example .goreleaser.yml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
before:
4+
hooks:
5+
- ./scripts/check-version.sh {{.Version}}
6+
builds:
7+
- main: ./cmd/restack
8+
binary: restack
9+
env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- linux
13+
- windows
14+
- darwin
15+
archives:
16+
- replacements:
17+
darwin: Darwin
18+
linux: Linux
19+
windows: Windows
20+
386: i386
21+
amd64: x86_64
22+
checksum:
23+
name_template: 'checksums.txt'
24+
snapshot:
25+
name_template: "{{ incminor .Tag }}-dev"
26+
changelog:
27+
# A commit log is not a changelog.
28+
skip: true

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Releases
22
========
33

4-
v0.4.0 (unreleased)
4+
v0.4.0 (2021-08-15)
55
-------------------
66

77
- Simplify command line argument parsing.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ archive and put the binaries somewhere on your `$PATH`.
1919

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

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

2828
Build From Source
2929
-----------------
3030

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

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

3636
Setup
3737
=====

scripts/check-version.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
5+
version="${1:-}"
6+
if [[ -z "$version" ]]; then
7+
echo >&2 "usage: $0 VERSION"
8+
exit 1
9+
fi
10+
11+
got=$(grep '^const Version = ".*"' version.go | cut -d'"' -f2)
12+
13+
if [[ "$got" == "$version" ]]; then
14+
exit 0
15+
fi
16+
17+
echo >&2 "version.go mismatch:"
18+
echo >&2 " want: $version"
19+
echo >&2 " got: $got"
20+
exit 1

scripts/release.sh

Lines changed: 0 additions & 58 deletions
This file was deleted.

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ package restack
55
// Note that semantic versioning in this repository applies to the `restack`
66
// executable, not to its library components. These APIs may break at any
77
// time without warning.
8-
const Version = "0.3.1"
8+
const Version = "0.4.0"

0 commit comments

Comments
 (0)