commit
7b672b01cb
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -13,6 +13,8 @@ jobs:
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v1
|
||||
|
26
.github/workflows/release.yml
vendored
Normal file
26
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,3 +25,4 @@ tests/report.xml
|
||||
|
||||
# node_modules
|
||||
tests/node_modules
|
||||
dist/
|
||||
|
58
.goreleaser.yml
Normal file
58
.goreleaser.yml
Normal file
@ -0,0 +1,58 @@
|
||||
project_name: dagger
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod download
|
||||
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./cmd/dagger
|
||||
binary: dagger
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X dagger.io/go/cmd/dagger/cmd.version={{.Version}}
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
|
||||
archives:
|
||||
- name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
|
||||
replacements:
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
- doc/**/*
|
||||
- examples/**/*
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
|
||||
brews:
|
||||
- tap:
|
||||
owner: dagger
|
||||
name: homebrew-tap
|
||||
commit_author:
|
||||
name: dagger-bot
|
||||
email: noreply@dagger.io
|
||||
homepage: "https://github.com/dagger/dagger"
|
||||
description: "Dagger is a programmable deployment system."
|
||||
test: |
|
||||
system "#{bin}/dagger version"
|
@ -39,6 +39,7 @@ func init() {
|
||||
plan.Cmd,
|
||||
input.Cmd,
|
||||
output.Cmd,
|
||||
versionCmd,
|
||||
)
|
||||
|
||||
if err := viper.BindPFlags(rootCmd.PersistentFlags()); err != nil {
|
||||
|
35
cmd/dagger/cmd/version.go
Normal file
35
cmd/dagger/cmd/version.go
Normal file
@ -0,0 +1,35 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultVersion = "devel"
|
||||
)
|
||||
|
||||
// set by goreleaser or other builder using
|
||||
// -ldflags='-X dagger.io/go/cmd/dagger/cmd.version=<version>'
|
||||
var (
|
||||
version = defaultVersion
|
||||
)
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print dagger version",
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if bi, ok := debug.ReadBuildInfo(); ok && version == defaultVersion {
|
||||
// No specific version provided via version
|
||||
version = bi.Main.Version
|
||||
}
|
||||
fmt.Printf("dagger version %v %s/%s\n",
|
||||
version,
|
||||
runtime.GOOS, runtime.GOARCH,
|
||||
)
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user