Skip to content

Commit

Permalink
add version string from git tags
Browse files Browse the repository at this point in the history
Signed-off-by: Hajime Tazaki <[email protected]>
  • Loading branch information
thehajime committed Oct 9, 2021
1 parent 7d981be commit 3aeaba2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ jobs:
else
echo "DOCKER_IMG_VERSION=${{ env.DOCKER_IMG_VERSION_DEFAULT }}" >> $GITHUB_ENV
fi
echo "GO_FLAGS=-ldflags \"-X main.version="${BUILD_VERSION}"\"" >> $GITHUB_ENV
- name: package installation (linux)
if: runner.os == 'linux' && matrix.arch == 'amd64'
Expand All @@ -145,14 +146,16 @@ jobs:
- name: Build
run: |
go install -v .
go install ${{ env.GO_FLAGS }} -v .
- name: Build shim
if: runner.os == 'macos'
run: |
go install -v ./cmd/containerd-shim-runu-v1
go install ${{ env.GO_FLAGS }} -v ./cmd/containerd-shim-runu-v1
- name: Go Test
if: matrix.arch == 'amd64'
run: |
sudo go test -v .
runu -v
- name: goreportcard
if: runner.os == 'linux' && matrix.arch == 'amd64'
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ const (
pidFile9p = "runu-9p.pid"
)

var (
version = ""
)

func main() {
app := cli.NewApp()
app.Name = "runu"
app.Usage = usage

var v []string
v = append(v, version)
v = append(v, fmt.Sprintf("spec: %s", specs.Version))
app.Version = strings.Join(v, "\n")

Expand Down

0 comments on commit 3aeaba2

Please sign in to comment.