Skip to content

Commit

Permalink
Switch to GH Actions and make releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Crosse committed Oct 18, 2022
1 parent 13a6cc4 commit 08b2816
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 21 deletions.
21 changes: 0 additions & 21 deletions .circleci/config.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Releases

on:
push:
tags:
- '*'

jobs:
release:
runs-on: macos-latest
permissions:
contents: write
steps:
- name: checkout
uses: actions/checkout@v3

- name: "setup go"
uses: actions/setup-go@v3
with:
cache: true
go-version-file: 'go.mod'

- name: build
run: make zip

- name: "create release"
uses: ncipollo/release-action@v1
with:
artifactErrorsFailBuild: true
artifacts: "release/*.zip"
draft: true
generateReleaseNotes: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sshsrv
/release/
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
NAME = sshsrv
PACKAGE = github.com/Crosse/$(NAME)

default: release

define build
@env GOOS=$(1) GOARCH=$(2) make release/$(NAME)-$(1)-$(2)$(3)
endef

release/$(NAME)-%:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o "$@" $(PACKAGE)

release/$(NAME)-darwin-universal: release/$(NAME)-darwin-amd64 release/$(NAME)-darwin-arm64
$(RM) "$@"
lipo -create -o "$@" $^

.PHONY: release
release:
mkdir -p release
$(call build,linux,arm)
$(call build,linux,amd64)
$(call build,linux,arm64)

$(call build,darwin,amd64)
$(call build,darwin,arm64)
@make release/$(NAME)-darwin-universal

$(call build,openbsd,arm)
$(call build,openbsd,amd64)
$(call build,openbsd,arm64)

$(call build,freebsd,arm)
$(call build,freebsd,amd64)
$(call build,freebsd,arm64)

$(call build,windows,amd64,.exe)
$(call build,windows,arm64,.exe)

.PHONY: zip
zip: release
find release -type f ! -name '*.zip' -execdir zip -9 "{}.zip" "{}" \;

.PHONY: clean
clean:
$(RM) -r release

0 comments on commit 08b2816

Please sign in to comment.