From 4138456688c8cd46a4844a099a3981882bffc7ab Mon Sep 17 00:00:00 2001 From: kidsan Date: Tue, 9 Nov 2021 09:23:17 +0100 Subject: [PATCH] feat: add goreleaser and github action --- .github/workflows/learn-github-actions.yml | 40 ++++++++++++++++++---- .goreleaser.yml | 25 ++++++++++++++ 2 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 9ba4c91..f87ce70 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -1,12 +1,38 @@ -name: learn-github-actions -on: [push] +name: release +on: + push: + branches: [master] jobs: - check-bats-version: + release: runs-on: ubuntu-latest steps: + - uses: GoogleCloudPlatform/release-please-action@v2 + id: release + with: + token: ${{ secrets.GITHUB_TOKEN }} + release-type: go + package-name: german + bump-minor-pre-major: true + - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 with: - node-version: '14' - - run: npm install -g bats - - run: bats -v \ No newline at end of file + fetch-depth: 0 + if: ${{ steps.release.outputs.release_created }} + + - uses: actions/setup-go@v2 + with: + go-version: '1.16' + if: ${{ steps.release.outputs.release_created }} + + - name: Clean working directory + run: git checkout . && git clean -f + if: ${{ steps.release.outputs.release_created }} + + - name: Create binaries, containers and GitHub release + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: ${{ steps.release.outputs.release_created }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..0a68702 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,25 @@ +# This is an example .goreleaser.yml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + # - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin +archives: + - replacements: + darwin: Darwin + linux: Linux + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +release: + name_template: "{{.ProjectName}}-v{{.Version}}" \ No newline at end of file