Skip to content

Commit

Permalink
ci: updates github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtcoder17 committed Dec 9, 2024
1 parent d1e77e4 commit a3df5e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v*'

branches:
- master

jobs:
build-binary:
strategy:
Expand All @@ -16,17 +19,21 @@ jobs:
- os: ubuntu-latest
goos: linux
platform: linux

- os: macos-13
goos: darwin
platform: darwin

- os: macos-14
goos: darwin
platform: darwin
exclude:
- os: macos-14
arch: amd64

- os: macos-13
arch: arm64

name: Building fwatcher-${{ matrix.platform }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
steps:
Expand Down
10 changes: 5 additions & 5 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ tasks:
cmds:
- go run .

dev:build:
cmds:
- go build -ldflags "-s -w -X main.Version={{.version}}" -o ./bin/{{.name}}

build:
requires:
vars:
- version
vars:
upx: '{{.upx | default "false"}}'
binary: '{{.binary | default .name }}'
date_str:
sh: "date '+%T %p (%Z) | %a %b %d, %Y'"
version_str: "[{{.version }}] built at {{.date_str}}"
env:
GOOS: '{{ .GOOS }}'
GOARCH: '{{ .GOARCH }}'
cmds:
- echo "building binary for ${GOOS:-$(go env GOOS)} (${GOARCH:-$(go env GOARCH)})"
- go build -ldflags "-s -w -X main.Version={{.version}}" -o ./bin/{{.binary}}
- echo version str "{{.version_str}}"
- go build -ldflags '-s -w -X "main.Version={{.version_str}}"' -o ./bin/{{.binary}}
- |+
if [[ "{{.upx}}" = "true" ]]; then
upx ./bin/{{.binary}}
Expand Down

0 comments on commit a3df5e2

Please sign in to comment.