Skip to content

Commit

Permalink
Release Github action
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschuch committed Sep 25, 2023
1 parent daa0c21 commit 775fbb1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Main

on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version: '1.21'

- name: Build
run: make build

- name: Release
uses: softprops/action-gh-release@v1
with:
files: bin/*
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

export CGO_ENABLED=0

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

# Builds the project.
build:
gox -os='linux darwin' \
-arch='amd64' \
-output='bin/imaginator_{{.OS}}_{{.Arch}}' \
-ldflags='-extldflags "-static"' \
$(PROJECT)
$(call build_step,linux,amd64)
$(call build_step,linux,arm64)
$(call build_step,darwin,amd64)
$(call build_step,darwin,arm64)

# Run all lint checking with exit codes for CI.
lint:
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"log"
"net/url"

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

err := fileutils.Download(image.String(), user, pass, target)
if err != nil {
fmt.Errorf("Failed to download: %w\n", err)
log.Println("Failed to download: %w\n", err)
}

return nil
Expand Down

0 comments on commit 775fbb1

Please sign in to comment.