mirror of https://github.com/pressly/goose.git
Add CI workflows to generate GitHub Releases and binaries on new tag push (#277)
parent
f24b19cca8
commit
97eae0915c
|
@ -0,0 +1,30 @@
|
|||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
|
||||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
@ -0,0 +1,51 @@
|
|||
# Documentation at https://goreleaser.com
|
||||
project_name: goose
|
||||
|
||||
gomod:
|
||||
proxy: true
|
||||
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./cmd/goose
|
||||
binary: goose
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
# Custom ldflags templates.
|
||||
# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.
|
||||
ldflags:
|
||||
- -s -w
|
||||
|
||||
# You can disable this pipe in order to not upload any artifacts.
|
||||
# Defaults to false.
|
||||
release:
|
||||
disable: false
|
||||
|
||||
archives:
|
||||
- replacements:
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
name_template: "{{ tolower .Binary }}_{{ tolower .Os }}_{{ tolower .Arch }}"
|
||||
format: binary
|
||||
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Version }}-next"
|
||||
|
||||
changelog:
|
||||
use: github
|
||||
sort: asc
|
||||
# Commit messages matching the regexp listed here will be removed from
|
||||
# the changelog.
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
# TODO(mf): add docker support?
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/pressly/goose/v3"
|
||||
)
|
||||
|
@ -20,12 +21,19 @@ var (
|
|||
sequential = flags.Bool("s", false, "use sequential numbering for new migrations")
|
||||
)
|
||||
|
||||
var (
|
||||
gooseVersion = ""
|
||||
)
|
||||
|
||||
func main() {
|
||||
flags.Usage = usage
|
||||
flags.Parse(os.Args[1:])
|
||||
|
||||
if *version {
|
||||
fmt.Println(goose.VERSION)
|
||||
if buildInfo, ok := debug.ReadBuildInfo(); ok && buildInfo != nil && gooseVersion == "" {
|
||||
gooseVersion = buildInfo.Main.Version
|
||||
}
|
||||
fmt.Printf("goose version:%s\n", gooseVersion)
|
||||
return
|
||||
}
|
||||
if *verbose {
|
||||
|
|
Loading…
Reference in New Issue