Skip to content

Commit

Permalink
Release v1.00
Browse files Browse the repository at this point in the history
  • Loading branch information
ncw committed Jan 26, 2015
1 parent 2529977 commit 268b434
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 8 deletions.
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
TAG := $(shell git describe --tags)
LAST_TAG := $(shell git describe --tags --abbrev=0)
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)')

snapshot-manager:
@go version
go install -v ./...

test: snapshot-manager
go test ./...

doc: snapshot-manager.1 README.html README.txt

snapshot-manager.1: README.md Makefile
pandoc -M "title=SNAPSHOT-MANAGER(1)" -M "date="`date -Id` -M "author=Memset Ltd" -s --from markdown --to man README.md -o snapshot-manager.1

README.html: README.md Makefile
pandoc -s --from markdown_github --to html README.md -o README.html

README.txt: README.md Makefile
pandoc -s --from markdown_github --to plain README.md -o README.txt

install: snapshot-manager
install -d ${DESTDIR}/usr/bin
install -t ${DESTDIR}/usr/bin ${GOPATH}/bin/snapshot-manager

clean:
go clean ./...
find . -name \*~ | xargs -r rm -f
rm -rf build
rm -f snapshot-manager snapshot-manager.1 README.html README.txt

.PHONY: upload

upload:
./upload $(TAG)

cross: doc
./cross-compile $(TAG)

tag:
@echo "Old tag is $(LAST_TAG)"
@echo "New tag is $(NEW_TAG)"
echo -e "package main\n const Version = \"$(NEW_TAG)\"\n" | gofmt > version.go
git tag $(NEW_TAG)
@echo "Add this to changelog in README.md"
@echo " * $(NEW_TAG) -" `date -I`
@git log $(LAST_TAG)..$(NEW_TAG) --oneline
@echo "Then commit the changes"
@echo git commit -m "Version $(NEW_TAG)" -a -v
@echo "And finally run make retag before make cross etc"

retag:
git tag -f $(LAST_TAG)
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Snapshot Manager
================

[![Logo](http://rclone.org/img/rclone-120x120.png)](http://rclone.org/)

Snapshot Manager is a command line program to manage Memset Miniserver snapshots.

See the [Memset snapshot
Expand All @@ -25,7 +23,7 @@ Snapshot Manager is a Go program and comes as a single binary file.

Download the binary for your OS from

* http://snapshot-manager.memset.com/
* https://github.com/Memset/snapshot-manager/releases/latest

Or alternatively if you have Go installed use

Expand Down Expand Up @@ -74,6 +72,8 @@ Usage

Run snapshot-manager without any parameters to see the help
```
snapshot-manager version v1.00 (C) Memset Ltd 2015
Manage snapshots in Memset Memstore
snapshot-manager <command> <arguments>
Expand All @@ -89,7 +89,7 @@ Commands
Full options:
-auth-url="https://auth.storage.memset.com/v1.0": Swift Auth URL - default is for Memstore
-chunk-size=67108864: Size of the chunks to make
-config="/home/ncw/.snapshot-manager.conf": Path to config file
-config="/home/user/.snapshot-manager.conf": Path to config file
-password="": Memstore password
-user="": Memstore user name, eg myaccaa1.admin
```
Expand Down Expand Up @@ -270,7 +270,7 @@ COPYING file included in this package).

Changelog
---------
* v1.00 - 2015-01-11
* v1.00 - 2015-01-26

Contact and support
-------------------
Expand Down
19 changes: 19 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Required software for making a release
* [github-release](https://github.com/aktau/github-release) for uploading packages
* [gox](https://github.com/mitchellh/gox) for cross compiling
* Run `gox -build-toolchain`
* This assumes you have your own source checkout
* pandoc for making the html and man pages

Making a release
* go get -u -f -v ./...
* make test
* make tag
* edit README.md
* git commit version.go README.md
* make retag
* # Set the GOPATH for a gox enabled compiler
* make cross
* make upload
* git push --tags origin master

31 changes: 31 additions & 0 deletions cross-compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

set -e

# This uses gox from https://github.com/mitchellh/gox
# Make sure you've run gox -build-toolchain

if [ "$1" == "" ]; then
echo "Syntax: $0 Version"
exit 1
fi
VERSION="$1"

rm -rf build

gox -output "build/{{.Dir}}-${VERSION}-{{.OS}}-{{.Arch}}/{{.Dir}}"

mv build/snapshot-manager-${VERSION}-darwin-amd64 build/snapshot-manager-${VERSION}-osx-amd64
mv build/snapshot-manager-${VERSION}-darwin-386 build/snapshot-manager-${VERSION}-osx-386

cd build

for d in `ls`; do
cp -a ../README.txt $d/
cp -a ../README.html $d/
cp -a ../snapshot-manager.1 $d/
zip -r9 $d.zip $d
rm -rf $d
done

cd ..
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ func deleteSnaphot(name string) {

// syntaxError prints the syntax
func syntaxError() {
fmt.Fprintf(os.Stderr, `Manage snapshots in Memset Memstore
fmt.Fprintf(os.Stderr, `%s version %s (C) Memset Ltd 2015
snapshot-manager <command> <arguments>
Manage snapshots in Memset Memstore
%s <command> <arguments>
Commands
Expand All @@ -152,7 +154,7 @@ Commands
types - available snapshot types
Full options:
`)
`, os.Args[0], Version, os.Args[0])
flag.PrintDefaults()
}

Expand Down
48 changes: 48 additions & 0 deletions upload
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
#
# Upload a release

set -e

REPO="snapshot-manager"

if [ "$1" == "" ]; then
echo "Syntax: $0 Version"
exit 1
fi
VERSION="$1"
if [ "$GITHUB_USER" == "" ]; then
echo 1>&2 "Need GITHUB_USER environment variable"
exit 1
fi
if [ "$GITHUB_TOKEN" == "" ]; then
echo 1>&2 "Need GITHUB_TOKEN environment variable"
exit 1
fi

echo "Making release ${VERSION}"
github-release release \
--repo ${REPO} \
--tag ${VERSION} \
--name "Snapshot Manager" \
--description "Tool to upload and download Memset snapshots"

for build in `ls build`; do
echo "Uploading ${build}"
base="${build%.*}"
parts=(${base//-/ })
os=${parts[3]}
arch=${parts[4]}

github-release upload \
--repo ${REPO} \
--tag ${VERSION} \
--name "${build}" \
--file build/${build}
done

github-release info \
--repo ${REPO} \
--tag ${VERSION}

echo "Done"
3 changes: 3 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package main

const Version = "v1.00"

0 comments on commit 268b434

Please sign in to comment.