From edf28d2256c64874047b1061bbd768170f502b58 Mon Sep 17 00:00:00 2001 From: prigotti Date: Tue, 18 May 2021 17:10:22 -0300 Subject: [PATCH] Add automated release support - Setup GoReleaser configuration to build and release binaries - Add GitHub Actions workflow to release based on new tags - Move dist/ configuration examples to example/ - Update version.Version variable with commit tag as ldflag --- .github/workflows/release.yaml | 35 +++++++++++++++++++++++++++++++++ .gitignore | 5 ++--- .goreleaser.yml | 36 ++++++++++++++++++++++++++++++++++ {dist => example}/client1.hcl | 0 {dist => example}/client2.hcl | 0 {dist => example}/server.hcl | 0 version/version.go | 2 +- 7 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yml rename {dist => example}/client1.hcl (100%) rename {dist => example}/client2.hcl (100%) rename {dist => example}/server.hcl (100%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..44dabfd --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: Release Drago + +on: + push: + tags: + - "v*" + +jobs: + release: + name: Release + runs-on: ubuntu-latest + + steps: + - name: Checkout branch + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index ec72a04..dbe8851 100644 --- a/.gitignore +++ b/.gitignore @@ -27,9 +27,8 @@ Godeps/ # End of https://www.gitignore.io/api/go ui/node_modules/* ui/.eslintcache -ui/build/**/ +ui/build vendor/* -!*.keep - tmp +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..c2c0917 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,36 @@ +before: + hooks: + - go mod tidy + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + - GO111MODULE=on + goos: + - linux + goarch: + - amd64 + - arm + - arm64 + ldflags: + - -s -w -extldflags "-static" + - -s -d -X version.Version={{ .Version }} +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: '{{ .ProjectName }}_v{{ .Version }}_checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +release: + name_template: "{{ .ProjectName }}-v{{ .Version }}" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/dist/client1.hcl b/example/client1.hcl similarity index 100% rename from dist/client1.hcl rename to example/client1.hcl diff --git a/dist/client2.hcl b/example/client2.hcl similarity index 100% rename from dist/client2.hcl rename to example/client2.hcl diff --git a/dist/server.hcl b/example/server.hcl similarity index 100% rename from dist/server.hcl rename to example/server.hcl diff --git a/version/version.go b/version/version.go index cae35eb..21a3c2d 100644 --- a/version/version.go +++ b/version/version.go @@ -11,7 +11,7 @@ var ( GitDescribe string // The main version number that is being run at the moment. - Version = "0.2.0" + Version = "dev" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release