-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters