Skip to content

Commit

Permalink
8 automate publishing cli (#9)
Browse files Browse the repository at this point in the history
* Allow Version to be set via LDFlags

* Add Release runner
  • Loading branch information
hectron authored Mar 4, 2022
1 parent e385ab2 commit 477d7be
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
release:
types: [created]

jobs:
release-matrix:
name: Release CLI

runs-on: ubuntu-latest

strategy:
matrix:
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
- goarch: arm64
goos: windows

steps:
- name: 🕵 Running git checkout
uses: actions/checkout@v2

- name: "Confirm Github Ref"
run: echo ${{ github.ref_name }}

- name: Release action
uses: wangyoucao577/go-release-action@v1.25
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goarch: ${{ matrix.goarch }}
goos: ${{ matrix.goos }}
goversion: "1.17"
extra_files: LICENSE README.md
ldflags: "-X 'main.Version=${{ github.ref_name }}'"

9 changes: 5 additions & 4 deletions define.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import (
"github.com/urfave/cli/v2"
)

const (
AppName = "go-define"
Version = "1.0.0"
)
const AppName = "go-define"

// this is injected using ldflags during compile time
// @see Makefile
var Version = ""

func main() {
app := &cli.App{
Expand Down

0 comments on commit 477d7be

Please sign in to comment.