Skip to content

Commit

Permalink
Add Build Files To Generate Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
cwarden committed Oct 13, 2023
1 parent b5536fd commit 29730d1
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2
jobs:
build:
docker:
- image: cimg/go:1.21
steps:
- checkout
- run: go install github.com/tcnksm/ghr@v0.16.0
- 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 osactivate*.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:
filters:
tags:
only: /^v.*/
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
EXECUTABLE=osactivate
WINDOWS=$(EXECUTABLE)_windows_amd64.exe
LINUX=$(EXECUTABLE)_linux_amd64
OSX_AMD64=$(EXECUTABLE)_osx_amd64
OSX_ARM64=$(EXECUTABLE)_osx_arm64
ALL=$(WINDOWS) $(LINUX) $(OSX_AMD64) $(OSX_ARM64)

default:
go build ${LDFLAGS}

install:
go install ${LDFLAGS}

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

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

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

$(OSX_ARM64):
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -v -o $(OSX_ARM64) ${LDFLAGS}

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

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

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

fmt:
go fmt ./...

test:
test -z "$(go fmt)"
go vet
go test ./...
go test -race ./...

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

.PHONY: default dist clean docs
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/octoberswimmer/omnistudio-activation

go 1.21.3
go 1.21

require (
github.com/ForceCLI/force v1.0.4
Expand Down

0 comments on commit 29730d1

Please sign in to comment.