Skip to content

Commit

Permalink
Tweak goreleaser to create AWS lambda compatible assets
Browse files Browse the repository at this point in the history
  • Loading branch information
agnes-gajda committed Feb 8, 2024
1 parent e87dd3e commit ecc2af1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 42 deletions.
40 changes: 11 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
17 changes: 4 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit ecc2af1

Please sign in to comment.