From ff22bba0d3ded279ad2fe0762d7cb983deb83ad3 Mon Sep 17 00:00:00 2001 From: Youngjin Jo Date: Mon, 9 Dec 2024 10:20:07 +0900 Subject: [PATCH] release: v1.0.0 Signed-off-by: Youngjin Jo --- .github/workflows/dispatch_release.yaml | 43 +++++++++-------------- .gitignore | 2 ++ .goreleaser.yaml | 46 +++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/dispatch_release.yaml b/.github/workflows/dispatch_release.yaml index 0c9b440..95c5dce 100644 --- a/.github/workflows/dispatch_release.yaml +++ b/.github/workflows/dispatch_release.yaml @@ -4,16 +4,16 @@ on: workflow_dispatch: inputs: version: - description: 'enter version(x.y.z)' + description: "enter version(x.y.z)" required: true - default: '0.0.0' + default: "0.0.0" container_arch: type: choice - description: 'choose container architecture' + description: "choose container architecture" default: linux/amd64 options: - - "linux/amd64" - - "linux/amd64,linux/arm64" + - "linux/amd64" + - "linux/amd64,linux/arm64" env: ARCH: ${{ github.event.inputs.container_arch }} @@ -46,37 +46,26 @@ jobs: author_name: Github Action Slack build: + needs: tagging runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.23.1' + go-version: "1.23.1" - - name: Build for all platforms - run: | - # macOS (Intel, Apple Silicon) - GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o dist/cfctl-darwin-amd64 - GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o dist/cfctl-darwin-arm64 - - # Linux (64bit, ARM) - GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/cfctl-linux-amd64 - GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o dist/cfctl-linux-arm64 - - # Windows (64bit) - GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/cfctl-windows-amd64.exe - - - name: Create Release - uses: softprops/action-gh-release@v1 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 with: - files: | - dist/cfctl-darwin-amd64 - dist/cfctl-darwin-arm64 - dist/cfctl-linux-amd64 - dist/cfctl-linux-arm64 - dist/cfctl-windows-amd64.exe + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Notice when job fails if: failure() diff --git a/.gitignore b/.gitignore index 485dee6..1d51fec 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .idea + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..0efee28 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,46 @@ +version: 2 + +before: + hooks: + - go mod tidy + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 + ldflags: + - -s -w + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + format_overrides: + - goos: windows + format: zip + +brews: + - repository: + owner: cloudforet-io + name: homebrew-tap + token: "{{ .Env.GITHUB_TOKEN }}" + homepage: "https://github.com/cloudforet-io/cfctl" + description: "Command-line interface for SpaceONE" + license: "Apache-2.0" + test: | + system "#{bin}/cfctl version" + install: | + bin.install "cfctl"