diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..95a3dde --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release +on: + push: + tags: ["v*"] + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v3 + with: + go-version: '1.19' + - name: get version + id: version + run: echo ::set-output name=version::$(basename ${GITHUB_REF}) + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.version }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..230389a --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,47 @@ +project_name: dbctl + +builds: + - id: dbctl + binary: dbctl + main: . + + ldflags: + - -X cmd.version={{.Version}} + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + +archives: + - id: dbctl + builds: [dbctl] + name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ incpatch .Version }}-next" + +changelog: + sort: asc + + groups: + - title: Features + regexp: "^.*feat[(\\w)]*:+.*$" + order: 0 + - title: 'Bug fixes' + regexp: "^.*fix[(\\w)]*:+.*$" + order: 1 + - title: Others + order: 999 + + filters: + exclude: + - '^docs:' + - '^test:' + - '^Merge pull request'