Skip to content

Commit

Permalink
Make a cool release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alexppg committed Jan 29, 2020
1 parent 29e1b9d commit 2389038
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Main
on: push

jobs:
build:
release:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
Expand All @@ -13,15 +13,15 @@ jobs:
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Build
- name: Test
run: make build
- name: Compress
- name: Build release
run: make release
if: startsWith(github.ref, 'refs/tags/')
run: tar -cvzf kube-ssh-proxy.tar.gz bin/kubectl-ssh_proxy bin/kube-ssh-proxy-ssh-bin
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: kube-ssh-proxy.tar.gz
files: releases/*.tar.gz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/bin/
/cover.out
/coverage.out
/releases/
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ $(BIN)/gopherbadger: PACKAGE=github.com/jpoles1/gopherbadger

# Build binaries
build: test
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o bin/kubectl-ssh_proxy cmd/main/*.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o bin/kube-ssh-proxy-ssh-bin cmd/ssh/*.go
go build -a -o bin/kubectl-ssh_proxy cmd/main/main.go
go build -a -o bin/kube-ssh-proxy-ssh-bin cmd/ssh/*.go

# Run go fmt against code
fmt:
Expand All @@ -35,3 +35,14 @@ test: fmt vet | $(GOPHERBADGER)
go test -coverprofile cover.out \
github.com/little-angry-clouds/kubectl-ssh-proxy/cmd/main
$(GOPHERBADGER) -md="README.md"

PLATFORMS := linux-amd64 linux-386 darwin-amd64 darwin-386 windows-amd64 windows-386
temp = $(subst -, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))
release: $(PLATFORMS)
$(PLATFORMS):
@mkdir -p releases; \
CGO_ENABLED=0 GOOS=$(os) GOARCH=$(arch) go build -a -o bin/kubectl-ssh_proxy-$(os)-$(arch) cmd/main/main.go; \
CGO_ENABLED=0 GOOS=$(os) GOARCH=$(arch) go build -a -o bin/kube-ssh-proxy-ssh-bin-$(os)-$(arch) cmd/ssh/*.go; \
tar -cvzf releases/kubectl-ssh-proxy-$(os)-$(arch).tar.gz bin/*-$(os)-$(arch)

0 comments on commit 2389038

Please sign in to comment.