Compare commits

...

4 Commits

Author SHA1 Message Date
Jim McDonald
91bc6ec86d Update cross-compile 2020-07-21 18:38:06 +01:00
Jim McDonald
cd55abc9bf Fix release version 2020-07-21 18:16:53 +01:00
Jim McDonald
44478e147e Add tag-based version 2020-07-21 18:04:36 +01:00
Jim McDonald
61b73b0f61 Rename workflow 2020-07-21 17:52:29 +01:00
2 changed files with 17 additions and 16 deletions

View File

@@ -1,8 +1,7 @@
name: Go
name: Release
on:
push:
# branches: [ master ]
tags:
- 'v*'
@@ -29,12 +28,6 @@ jobs:
dep ensure
fi
- name: Build
run: go build -v .
- name: Test
run: go test -v .
- name: Set env
run: |
echo '::set-env name=GO111MODULE::on'
@@ -49,12 +42,18 @@ jobs:
echo "::set-env name=RELEASE_VERSION::${RELEASE_VERSION}"
echo "::set-output name=RELEASE_VERSION::${RELEASE_VERSION}"
- name: Build
run: go build -v -ldflags="-X github.com/wealdtech/ethdo/cmd.ReleaseVersion=${RELEASE_VERSION}" .
- name: Test
run: go test -v .
- name: Fetch xgo
run: |
go get github.com/suburbandad/xgo
- name: Cross-compile
run: xgo -v -x --targets="linux/amd64,linux/arm64,windows/amd64" github.com/wealdtech/ethdo
run: xgo -v -x -ldflags="-X github.com/wealdtech/ethdo/cmd.ReleaseVersion=${RELEASE_VERSION}" --targets="linux/amd64,linux/arm64,windows/amd64" github.com/wealdtech/ethdo
- name: Create windows zip file
run: |
@@ -71,7 +70,7 @@ jobs:
mv ethdo-linux-arm64 ethdo
tar zcf ethdo-${RELEASE_VERSION}-linux-arm64.tar.gz ethdo
- name: Create release
- name: Create draft release
id: create_release
uses: actions/create-release@v1
env:
@@ -80,7 +79,7 @@ jobs:
tag_name: ${{ github.ref }}
release_name: Release ${{ env.RELEASE_VERSION }}
draft: true
prerelease: true
prerelease: false
- name: Upload windows zip file
id: upload-release-asset-windows

View File

@@ -1,4 +1,4 @@
// Copyright © 2019 Weald Technology Trading
// Copyright © 2019, 2020 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -22,15 +22,17 @@ import (
"github.com/spf13/viper"
)
var ReleaseVersion = "local build"
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Version of Ethdo",
Long: `Obtain the version of Ethdo. For example:
Short: "Version of ethdo",
Long: `Obtain the version of ethdo. For example:
ethdo version.`,
ethdo version`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("1.5.0-prerelease")
fmt.Println(ReleaseVersion)
if viper.GetBool("verbose") {
buildInfo, ok := dbg.ReadBuildInfo()
if ok {