Skip to content

Commit

Permalink
Merge branch 'build-binaries'
Browse files Browse the repository at this point in the history
  • Loading branch information
cwarden committed Dec 31, 2020
2 parents b93ccbf + 85cf309 commit 0d7a213
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.15
steps:
- checkout
- run: go get -u github.com/mitchellh/gox
- run: go get -u github.com/tcnksm/ghr
- run: sudo apt-get update && sudo apt-get install p7zip-full
- restore_cache: # restores saved cache if no changes are detected since last run
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run: make dist
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: create release
command: |
if [ "$CIRCLE_TAG" ]; then
mkdir -p dist
mv force-md*.zip dist
ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace $CIRCLE_TAG dist/
else
echo "No tag"
fi
workflows:
version: 2
build-workflow: # the name of our workflow
jobs: # the jobs that we are sequencing.
- build
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
VERSION=$(shell git describe --abbrev=0 --always)
LDFLAGS = -ldflags "-X github.com/octoberswimmer/force-md/cmd.version=${VERSION}"
EXECUTABLE=force-md
WINDOWS=$(EXECUTABLE)_windows_amd64.exe
LINUX=$(EXECUTABLE)_linux_amd64
OSX=$(EXECUTABLE)_osx_amd64
ALL=$(WINDOWS) $(LINUX) $(OSX)

default:
go build ${LDFLAGS}

install:
go install ${LDFLAGS}

$(WINDOWS):
env GOOS=windows GOARCH=amd64 go build -v -o $(WINDOWS) ${LDFLAGS}

$(LINUX):
env GOOS=linux GOARCH=amd64 go build -v -o $(LINUX) ${LDFLAGS}

$(OSX):
env GOOS=darwin GOARCH=amd64 go build -v -o $(OSX) ${LDFLAGS}

$(basename $(WINDOWS)).zip: $(WINDOWS)
zip $@ $<
7za rn $@ $< $(EXECUTABLE)$(suffix $<)

%.zip: %
zip $@ $<
7za rn $@ $< $(EXECUTABLE)

dist: $(addsuffix .zip,$(basename $(ALL)))

clean:
-rm -f $(EXECUTABLE) $(EXECUTABLE)_*

.PHONY: default dist clean
4 changes: 4 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import (
"github.com/spf13/cobra"
)

var (
version = "0.1"
)

var rootCmd = &cobra.Command{
Use: "force-md",
Short: "force-md manipulate Salesforce metadata",
Expand Down

0 comments on commit 0d7a213

Please sign in to comment.