diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d16140be..ec97d4e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,48 +4,30 @@ name: release on: push: tags: - - '*' + - 'v[0-9]+.[0-9]+.[0-9]+*' -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - - name: Setup go - uses: actions/setup-go@v4 - with: - go-version: '1.20.x' - - - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@latest - - - name: Run staticcheck - run: staticcheck ./... - - - name: Run Tests - run: go test -p 1 -cover -race -v ./... +permissions: + contents: write +jobs: release: runs-on: ubuntu-latest - needs: [ test ] steps: - name: Checkout - uses: actions/checkout@v3 - - - name: Unshallow - run: git fetch --prune --unshallow + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20.x' + go-version: '1.21.x' - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 8779680c..a904712c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -5,26 +5,19 @@ before: hooks: - go mod download builds: -- env: +- id: '{{ .ProjectName }}' + binary: bootstrap + env: - CGO_ENABLED=0 goos: - linux - - darwin - - windows goarch: - - 386 - amd64 - - arm - arm64 - ignore: - - goos: darwin - goarch: 386 - - goos: windows - goarch: 386 ldflags: - -s -w -X github.com/awslabs/ssosync/cmd.version={{.Version}} -X github.com/awslabs/ssosync/cmd.commit={{.Commit}} -X github.com/awslabs/ssosync/cmd.date={{.Date}} -X github.com/awslabs/ssosync/cmd.builtBy=goreleaser checksum: - name_template: '{{ .ProjectName }}_checksums.txt' + name_template: '{{ .ProjectName }}_checksum.txt' changelog: sort: asc filters: @@ -38,10 +31,8 @@ archives: {{- .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end -}} format_overrides: - goos: windows format: zip -