Use git tag as version
This commit is contained in:
parent
c1c43d2a41
commit
9cf42af251
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@ -22,11 +22,11 @@ jobs:
|
|||||||
os: [ windows-latest, ubuntu-latest, macos-latest ]
|
os: [ windows-latest, ubuntu-latest, macos-latest ]
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
BIN_SUFFIX:
|
BIN_SUFFIX: ""
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
BIN_SUFFIX:
|
BIN_SUFFIX: ""
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
BIN_SUFFIX: .exe
|
BIN_SUFFIX: ".exe"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout codebase
|
- name: Checkout codebase
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@ -38,12 +38,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup vars
|
- name: Setup vars
|
||||||
id: vars
|
id: vars
|
||||||
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
|
run: |
|
||||||
|
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
|
||||||
|
echo "::set-output name=git_tag::$(git describe --tags)"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
run: go build -trimpath -ldflags="-w -s" -v -o um-${{ runner.os }}${{ matrix.BIN_SUFFIX }} ./cmd/um
|
run: go build -trimpath -ldflags="-w -s -X main.AppVersion=${{ steps.vars.outputs.git_tag }}" -v -o um-${{ runner.os }}${{ matrix.BIN_SUFFIX }} ./cmd/um
|
||||||
|
|
||||||
- name: Publish artifact
|
- name: Publish artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
@ -18,12 +18,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var AppVersion = "0.0.3"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.App{
|
app := cli.App{
|
||||||
Name: "Unlock Music CLI",
|
Name: "Unlock Music CLI",
|
||||||
HelpName: "um",
|
HelpName: "um",
|
||||||
Usage: "Unlock your encrypted music file https://github.com/unlock-music/cli",
|
Usage: "Unlock your encrypted music file https://github.com/unlock-music/cli",
|
||||||
Version: "v0.0.1",
|
Version: AppVersion,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{Name: "input", Aliases: []string{"i"}, Usage: "path to input file or dir", Required: true},
|
&cli.StringFlag{Name: "input", Aliases: []string{"i"}, Usage: "path to input file or dir", Required: true},
|
||||||
&cli.StringFlag{Name: "output", Aliases: []string{"o"}, Usage: "path to output dir", Required: true},
|
&cli.StringFlag{Name: "output", Aliases: []string{"o"}, Usage: "path to output dir", Required: true},
|
||||||
|
Loading…
Reference in New Issue
Block a user