From 3e70ac213a8eb6ca7eb3328410e672ec5d934cab Mon Sep 17 00:00:00 2001 From: sivchari Date: Fri, 25 Oct 2024 17:48:19 +0900 Subject: [PATCH] add goreleaser (#43) * add goreleaser Signed-off-by: sivchari * delete workflow.yml Signed-off-by: sivchari --------- Signed-off-by: sivchari --- .github/workflows/release.yaml | 23 ++++++++++++++++ .../workflows/{workflows.yml => test.yaml} | 4 ++- goreleaser.yaml | 26 +++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml rename .github/workflows/{workflows.yml => test.yaml} (97%) create mode 100644 goreleaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..8c3a298 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,23 @@ +name: Release + +on: + push: + tags: + - "v*" +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - uses: goreleaser/goreleaser-action@v5 + with: + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/workflows.yml b/.github/workflows/test.yaml similarity index 97% rename from .github/workflows/workflows.yml rename to .github/workflows/test.yaml index c8c4e90..ea3a2e5 100644 --- a/.github/workflows/workflows.yml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: test_and_lint +name: test on: push: @@ -28,9 +28,11 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- + - name: Get dependencies run: | go mod download + - name: Test run: go test ./... diff --git a/goreleaser.yaml b/goreleaser.yaml new file mode 100644 index 0000000..56db218 --- /dev/null +++ b/goreleaser.yaml @@ -0,0 +1,26 @@ +project_name: tenv + +env: + - GO111MODULE=on + +builds: + - id: tenv + main: ./cmd/tenv/main.go + binary: tenv + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + +archives: + - id: tenv + builds: + - tenv + name_template: '{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + format_overrides: + - goos: windows + format: zip