Skip to content

Commit

Permalink
cd: release binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
mcuadros committed Mar 19, 2020
1 parent 58e1036 commit 8ac28ec
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 46 deletions.
54 changes: 19 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@

on: release
name: Build
on:
release:
types: [created]

name: Release
jobs:
release-linux-amd64:
name: Release linux/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: compile and release
uses: ngs/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOARCH: amd64
GOOS: linux

release-darwin-amd64:
name: Release darwin/amd64
release:
strategy:
fail-fast: false
matrix:
goos: [linux, windows, darwin]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: compile and release
uses: ngs/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOARCH: amd64
GOOS: darwin
- name: Checkout code
uses: actions/checkout@v2

release-windows-amd64:
name: Release windows/amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: compile and release
uses: ngs/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOARCH: amd64
GOOS: windows
- name: Release binaries
uses: mcuadros/go-release-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: amd64
ldflags: -X main.commit=${{ github.sha }} -X main.version=${{ github.ref }}
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ jobs:

- name: Checkout code
uses: actions/checkout@v2

- name: Test
run: go test ./...
25 changes: 14 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import (
)

var (
version = "undefined"
build = "undefined"
commit = "undefined"
version = "not-set"
commit = "not-set"
)

func main() {
Expand Down Expand Up @@ -146,17 +145,21 @@ func main() {
fmt.Print(buf.String())
}

const usageFormat = `enry, a simple (and faster) implementation of github/linguist
usage: %[1]s [-mode=(file|line|byte)] [-prog] <path>
%[1]s [-mode=(file|line|byte)] [-prog] [-json] [-breakdown] <path>
%[1]s [-mode=(file|line|byte)] [-prog] [-json] [-breakdown]
%[1]s [-version]
build info: %[2]s, commit: %[3]s, based on linguist commit: %[4]s
`

func usage() {
fmt.Fprintf(
os.Stderr,
` %[1]s %[2]s build: %[3]s commit: %[4]s, based on linguist commit: %[5]s
%[1]s, A simple (and faster) implementation of github/linguist
usage: %[1]s [-mode=(file|line|byte)] [-prog] <path>
%[1]s [-mode=(file|line|byte)] [-prog] [-json] [-breakdown] <path>
%[1]s [-mode=(file|line|byte)] [-prog] [-json] [-breakdown]
%[1]s [-version]
`,
os.Args[0], version, build, commit, data.LinguistCommit[:7],
usageFormat,
os.Args[0], version, commit[:7], data.LinguistCommit[:7],
)
}

Expand Down

0 comments on commit 8ac28ec

Please sign in to comment.