Compare commits

...

14 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
Jim McDonald
5ce7491d73 Fix workflow 2020-07-21 17:13:40 +01:00
Jim McDonald
b5ecf56382 Tidy ups 2020-07-21 16:42:01 +01:00
Jim McDonald
0acb57df48 Update trigger 2020-07-21 16:20:14 +01:00
Jim McDonald
325baf9f8e Update workflow 2020-07-21 16:17:55 +01:00
Jim McDonald
1c2385e413 Catch potential error 2020-07-21 16:09:56 +01:00
Jim McDonald
c06a709463 Update workflow 2020-07-21 15:57:37 +01:00
Jim McDonald
735cc3ae4b Update workflow 2020-07-21 15:31:12 +01:00
Jim McDonald
2da00b3930 Update workflow 2020-07-21 14:45:58 +01:00
Jim McDonald
f5db041ad8 Update workflow 2020-07-21 13:01:39 +01:00
Jim McDonald
1d94b90013 Update workflow 2020-07-21 12:37:41 +01:00
2 changed files with 45 additions and 33 deletions

View File

@@ -1,8 +1,7 @@
name: Go
name: Release
on:
push:
# branches: [ master ]
tags:
- 'v*'
@@ -23,53 +22,64 @@ jobs:
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: go build -v .
- name: Test
run: go test -v .
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Set env
run: |
echo '::set-env name=GO111MODULE::on'
# Release tag comes from the github reference.
RELEASE_TAG=$(echo ${GITHUB_REF} | sed -e 's!.*/!!')
echo "::set-env name=RELEASE_TAG::${RELEASE_TAG}"
echo "::set-output name=RELEASE_TAG::${RELEASE_TAG}"
# Ensure the release tag has expected format.
echo ${RELEASE_TAG} | grep -q '^v' || exit 1
# Release version is same as release tag without leading 'v'.
RELEASE_VERSION=$(echo ${GITHUB_REF} | sed -e 's!.*/v!!')
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
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: |
mv ethdo-windows-4.0-amd64.exe ethdo.exe
zip --junk-paths ethdo-${{ github.ref }}-windows-exe.zip ethdo.exe
zip --junk-paths ethdo-${RELEASE_VERSION}-windows-exe.zip ethdo.exe
- name: Create linux AMD64 tgz file
run: |
mv ethdo-linux-amd64 ethdo
tar zcf ethdo-${{ github.ref }}-linux-amd64.tar.gz ethdo
tar zcf ethdo-${RELEASE_VERSION}-linux-amd64.tar.gz ethdo
- name: Create linux ARM64 tgz file
run: |
mv ethdo-linux-arm64 ethdo
tar zcf ethdo-${{ github.ref }}-linux-arm64.tar.gz 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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: true
release_name: Release ${{ env.RELEASE_VERSION }}
draft: true
prerelease: false
- name: Upload windows zip file
id: upload-release-asset-windows
@@ -78,8 +88,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ethdo-${{ github.ref }}-windows-exe.zip
asset_name: ethdo-${{ github.ref }}-windows-exe.zip
asset_path: ./ethdo-${{ env.RELEASE_VERSION }}-windows-exe.zip
asset_name: ethdo-${{ env.RELEASE_VERSION }}-windows-exe.zip
asset_content_type: application/zip
- name: Upload linux AMD64 tgz file
@@ -89,8 +99,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ethdo-${{ github.ref }}-linux-amd64.tar.gz
asset_name: ethdo-${{ github.ref }}-linux-amd64.tar.gz
asset_path: ./ethdo-${{ env.RELEASE_VERSION }}-linux-amd64.tar.gz
asset_name: ethdo-${{ env.RELEASE_VERSION }}-linux-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload linux ARM64 tgz file
@@ -100,6 +110,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ethdo-${{ github.ref }}-linux-arm64.tar.gz
asset_name: ethdo-${{ github.ref }}-linux-arm64.tar.gz
asset_path: ./ethdo-${{ env.RELEASE_VERSION }}-linux-arm64.tar.gz
asset_name: ethdo-${{ env.RELEASE_VERSION }}-linux-arm64.tar.gz
asset_content_type: application/gzip

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 {