Skip to content

Commit 775fbb1

Browse files
committed
Release Github action
1 parent daa0c21 commit 775fbb1

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- uses: actions/setup-go@v3
16+
with:
17+
go-version: '1.21'
18+
19+
- name: Build
20+
run: make build
21+
22+
- name: Release
23+
uses: softprops/action-gh-release@v1
24+
with:
25+
files: bin/*

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
export CGO_ENABLED=0
44

5-
PROJECT=github.com/previousnext/imaginator
5+
define build_step
6+
GOOS=$(1) GOARCH=$(2) go build -o bin/imaginator-$(1)-$(2) -ldflags='-extldflags "-static"' github.com/previousnext/imaginator
7+
endef
68

79
# Builds the project.
810
build:
9-
gox -os='linux darwin' \
10-
-arch='amd64' \
11-
-output='bin/imaginator_{{.OS}}_{{.Arch}}' \
12-
-ldflags='-extldflags "-static"' \
13-
$(PROJECT)
11+
$(call build_step,linux,amd64)
12+
$(call build_step,linux,arm64)
13+
$(call build_step,darwin,amd64)
14+
$(call build_step,darwin,arm64)
1415

1516
# Run all lint checking with exit codes for CI.
1617
lint:

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"fmt"
5+
"log"
56
"net/url"
67

78
"github.com/alecthomas/kingpin/v2"
@@ -48,7 +49,7 @@ func run(source, user, pass, target string) error {
4849

4950
err := fileutils.Download(image.String(), user, pass, target)
5051
if err != nil {
51-
fmt.Errorf("Failed to download: %w\n", err)
52+
log.Println("Failed to download: %w\n", err)
5253
}
5354

5455
return nil

0 commit comments

Comments
 (0)