Skip to content

Commit

Permalink
Add basic release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlloyd committed Jan 28, 2018
1 parent 54eae18 commit b9a9a62
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
vendor/
build/
dist/
.github_token
39 changes: 39 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
project_name: rif
release:
github:
owner: turingincomplete
name: rif
name_template: '{{.Tag}}'
builds:
- goos:
- windows
- linux
- darwin
goarch:
- amd64
- "386"
goarm:
- "6"
main: cmd/rif.go
hooks:
pre: ./scripts/buildno
ldflags: -s -w -X main.version={{.Version}} -X main.buildNo={{.Env.BUILDNO}}
binary: rif
archive:
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm
}}v{{ .Arm }}{{ end }}'
format: tar.gz
files:
- licence*
- LICENCE*
- license*
- LICENSE*
- readme*
- README*
- changelog*
- CHANGELOG*
snapshot:
name_template: SNAPSHOT-{{ .Commit }}
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'
dist: dist
22 changes: 1 addition & 21 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,7 @@ cd "$(dirname "$0")/.."

[ -d build ] || mkdir build

if git diff-index --quiet HEAD --; then
UNCOMMITED_CHANGES="false"
else
UNCOMMITED_CHANGES="true"
fi

if git describe --exact-match HEAD 2> /dev/null; then
IS_RELEASE_COMMIT="true"
else
IS_RELEASE_COMMIT="false"
fi

if $UNCOMMITED_CHANGES == "true"; then
SUFFIX="-WIP"
elif ! $IS_RELEASE_COMMIT == "true"; then
SUFFIX="-DEV"
else
SUFFIX=""
fi

BUILDNO="$(git rev-parse --short HEAD)$SUFFIX"
BUILDNO="$(./scripts/buildno)"
VERSION=$(git describe --abbrev=0 --tags)

echo "Building: RIF version $VERSION, Build No $BUILDNO"
Expand Down
27 changes: 27 additions & 0 deletions scripts/buildno
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -euo pipefail
cd "$(dirname "$0")/.."

if git diff-index --quiet HEAD --; then
UNCOMMITED_CHANGES="false"
else
UNCOMMITED_CHANGES="true"
fi

if git describe --exact-match HEAD 2> /dev/null; then
IS_RELEASE_COMMIT="true"
else
IS_RELEASE_COMMIT="false"
fi

if $UNCOMMITED_CHANGES == "true"; then
SUFFIX="-WIP"
elif ! $IS_RELEASE_COMMIT == "true"; then
SUFFIX="-DEV"
else
SUFFIX=""
fi

BUILDNO="$(git rev-parse --short HEAD)$SUFFIX"
echo $BUILDNO
9 changes: 9 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -euo pipefail
cd "$(dirname "$0")/.."

export BUILDNO=$(./scripts/buildno)
export GITHUB_TOKEN=$(cat .github_token)

goreleaser --rm-dist
6 changes: 6 additions & 0 deletions scripts/test-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euo pipefail
cd "$(dirname "$0")/.."

BUILDNO=$(./scripts/buildno) goreleaser --rm-dist --skip-publish --skip-validate

0 comments on commit b9a9a62

Please sign in to comment.