From 68126dcc67a630ded42b17b28cb5dec4981641b8 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Fri, 19 Apr 2024 12:23:18 +0200 Subject: [PATCH] [ci] setting up goreleaser config --- .github/workflows/go.yml | 2 ++ .github/workflows/release.yml | 29 +++++++++++++++++++++++++++++ .gitignore | 5 ++++- .goreleaser.yaml | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4b30f36..c58f09c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -46,3 +46,5 @@ jobs: version: latest only-new-issues: true # on PR only show new issues skip-cache: true # avoid influencing caching that also hurts the build job + + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..792b0c8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: goreleaser + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 26d4696..dfed0ae 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,7 @@ go.work *.toml -secret-key \ No newline at end of file +secret-key +dist/ + +go-releaser.sh \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..aeca53a --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,34 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json + +version: 1 + +before: + hooks: + - go mod tidy + +builds: + - main: './cmd/backup' + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + +changelog: + sort: asc + filters: + exclude: + - "^[ci]" + - "^[test]" + - "^[chore]"