Skip to content

Commit

Permalink
Merge pull request #20 from blp1526/zip
Browse files Browse the repository at this point in the history
Add zip
  • Loading branch information
blp1526 authored Jul 23, 2017
2 parents b8b2fbc + 62dc816 commit 3449e9d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
scv
archives/

### https://raw.github.com/github/gitignore/c0c1a480a906df0e023f3250cf2ad82f1612be67/Go.gitignore

Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
.PHONY: all clean test
.PHONY: all zip build clean test

all:
all: build

zip: build
@./zip

build:
@go build -ldflags "-X github.com/blp1526/scv/cmd.version="$(shell ./version)

clean:
@go clean
@rm -rf archives

test:
@go test ./...
28 changes: 28 additions & 0 deletions zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

unames=$(uname -s)
if [ ${unames} = "Linux" ]; then
GOOS="linux"
elif [ ${unames} = "Darwin" ]; then
GOOS="darwin"
else
echo "fatal: Unsupported OS"
exit 1
fi

unamem=$(uname -m)
if [ ${unamem} = "x86_64" ]; then
GOARCH="amd64"
else
echo "fatal: Unsupported ARCH"
exit 1
fi

rm -rf "archives"
path="archives/scv_${GOOS}_${GOARCH}"
mkdir -p ${path}
mv scv ${path}
zip -r "${path}.zip" ${path} > /dev/null
rm -rf "${path}"

echo "${path}.zip created"

0 comments on commit 3449e9d

Please sign in to comment.