From 2bf733780b045bce9fa6c4f7746f4c8a8306cf3a Mon Sep 17 00:00:00 2001 From: ASAKURA Kazuki <32762324+Arthur1@users.noreply.github.com> Date: Sat, 22 Jul 2023 16:03:20 +0900 Subject: [PATCH] init goreleaser --- .github/workflows/on-push-main.yml | 2 ++ .github/workflows/on-version-tag.yml | 15 ++++++++++++++ .github/workflows/wf-release.yml | 22 +++++++++++++++++++++ .github/workflows/wf-test-go.yml | 2 ++ .gitignore | 2 ++ .goreleaser.yaml | 29 ++++++++++++++++++++++++++++ 6 files changed, 72 insertions(+) create mode 100644 .github/workflows/on-version-tag.yml create mode 100644 .github/workflows/wf-release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/on-push-main.yml b/.github/workflows/on-push-main.yml index 47dc016..4740ee3 100644 --- a/.github/workflows/on-push-main.yml +++ b/.github/workflows/on-push-main.yml @@ -1,3 +1,5 @@ +name: CI for main branch + on: push: branches: [main] diff --git a/.github/workflows/on-version-tag.yml b/.github/workflows/on-version-tag.yml new file mode 100644 index 0000000..e321dc8 --- /dev/null +++ b/.github/workflows/on-version-tag.yml @@ -0,0 +1,15 @@ +name: CI for version tag + +on: + push: + tags: + - "v*" + +jobs: + test-go: + uses: ./.github/workflows/wf-test-go.yml + + release: + needs: + - test-go + uses: ./.github/workflows/wf-release.yml diff --git a/.github/workflows/wf-release.yml b/.github/workflows/wf-release.yml new file mode 100644 index 0000000..5c37fd5 --- /dev/null +++ b/.github/workflows/wf-release.yml @@ -0,0 +1,22 @@ +name: release + +on: + workflow_call: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version-file: go.mod + - uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/wf-test-go.yml b/.github/workflows/wf-test-go.yml index 4baa3d9..dd9f46f 100644 --- a/.github/workflows/wf-test-go.yml +++ b/.github/workflows/wf-test-go.yml @@ -1,3 +1,5 @@ +name: test-go + on: workflow_call: diff --git a/.gitignore b/.gitignore index 1310adc..ec3f345 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ go.work # config file for otlc otlc.yaml + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..6e3c2fa --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,29 @@ +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + +archives: + - format: tar.gz + 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 }} +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:'