diff --git a/.github/workflows/int.yml b/.github/workflows/int.yml index 3a05f81..eed8aee 100644 --- a/.github/workflows/int.yml +++ b/.github/workflows/int.yml @@ -37,13 +37,23 @@ jobs: go mod vendor - run: sudo go test -v - - run: go build -ldflags="-s -w" -o ./agent + + - uses: goreleaser/goreleaser-action@5df302e5e9e4c66310a6b6493a8865b12c555af2 + with: + distribution: goreleaser + version: latest + args: release --snapshot --clean --config releasers/int.yml + - name: Configure aws credentials uses: aws-actions/configure-aws-credentials@ea7b857d8a33dc2fb4ef5a724500044281b49a5e with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-west-2 + + - run: | + ls -lahR + - run: aws s3 cp ./agent s3://step-security-agent/refs/heads/int/agent --acl public-read - name: Integration test uses: docker://ghcr.io/step-security/integration-test/int:latest diff --git a/.goreleaser.yml b/.goreleaser.yml index 5d9aa26..9c6ead2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -18,7 +18,7 @@ builds: flags: - -trimpath ldflags: - - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date=123 -X main.ReleaseTag={{.Tag}} + - -s -w -X main.version={{.Version}} -X main.ReleaseCommit={{.FullCommit}} -X main.date=123 -X main.ReleaseTag={{.Tag}} -X ain.ReleaseBranch={{.Branch}} # Optionally override the matrix generation and specify only the final list of targets. diff --git a/buildinfo.go b/buildinfo.go index 2529809..b36b5b8 100644 --- a/buildinfo.go +++ b/buildinfo.go @@ -4,10 +4,11 @@ import "fmt" // filled through ldflags var ( - ReleaseTag = "" - commit = "" + ReleaseTag = "" + ReleaseBranch = "" + ReleaseCommit = "" ) func LogBuildInfo() { - WriteLog(fmt.Sprintf("[buildInfo] tag=%s commit=%s \n", ReleaseTag, commit)) + WriteLog(fmt.Sprintf("[buildInfo] tag=%s commit=%s branch=%s \n", ReleaseTag, ReleaseCommit, ReleaseBranch)) } diff --git a/releasers/int.yml b/releasers/int.yml new file mode 100644 index 0000000..7fe503b --- /dev/null +++ b/releasers/int.yml @@ -0,0 +1,28 @@ +# .goreleaser.yml +builds: + # You can have multiple builds defined as a yaml list + - + # GOOS list to build for. + # For more info refer to: https://golang.org/doc/install/source#environment + # Defaults are darwin and linux. + goos: + - linux + + # GOARCH to build for. + # For more info refer to: https://golang.org/doc/install/source#environment + # Defaults are 386, amd64 and arm64. + goarch: + - amd64 + + mod_timestamp: '123' + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.FullCommit}} -X main.date=123 -X main.ReleaseTag=int -X main.ReleaseBranch=int -X main.ReleaseCommit={{.FullCommit}} + + + # Optionally override the matrix generation and specify only the final list of targets. + # Format is `{goos}_{goarch}` with optionally a suffix with `_{goarm}` or `_{gomips}`. + # This overrides `goos`, `goarch`, `goarm`, `gomips` and `ignores`. + targets: + - linux_amd64 \ No newline at end of file