Skip to content

Commit fe47a90

Browse files
authored
set-up multi-arch binary compilation (#9)
Changes project structure to facilitate multi-arch package release to Github
1 parent 317f239 commit fe47a90

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
with:
1919
go-version: 1.19
2020
- name: Build motion-poll
21-
run: go build -v motion-poll.go
21+
run: go build -v ./cmd/motion-poll/motion-poll.go
2222
- name: Build set-time
23-
run: go build -v set-time.go
23+
run: go build -v ./cmd/set-time/set-time.go

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
8+
jobs:
9+
releases-matrix:
10+
name: Release Go Binary
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
15+
goos: [linux, windows, darwin]
16+
goarch: ["386", amd64, arm64]
17+
exclude:
18+
- goarch: "386"
19+
goos: darwin
20+
- goarch: arm64
21+
goos: windows
22+
steps:
23+
- name: checkout
24+
uses: actions/checkout@v3
25+
- name: release motion-poll
26+
uses: wangyoucao577/go-release-action@v1
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
goos: ${{ matrix.goos }}
30+
goarch: ${{ matrix.goarch }}
31+
goversion: "https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz"
32+
project_path: "./cmd/motion-poll"
33+
binary_name: "motion-poll"
34+
extra_files: LICENSE.txt README.md
35+
- name: release set-time
36+
uses: wangyoucao577/go-release-action@v1
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
goos: ${{ matrix.goos }}
40+
goarch: ${{ matrix.goarch }}
41+
goversion: "https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz"
42+
project_path: "./cmd/set-time"
43+
binary_name: "set-time"
44+
extra_files: LICENSE.txt README.md
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package motion_poll
22

33
import (
44
"github.com/jessevdk/go-flags"

set-time.go renamed to cmd/set-time/set-time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package set_time
22

33
import (
44
"fmt"

0 commit comments

Comments
 (0)