Skip to content

Commit

Permalink
feat: add new goreleaser build chain (#1932)
Browse files Browse the repository at this point in the history
This patch adds full compatibility with ARM architectures, including Apple Silicon (M1). We additionally added cryptographically signed signatures verifiable using [cosign](https://github.com/sigstore/cosign) for both binaries as well as docker images.

BREAKING CHANGES: To celebrate this change, we cleaned up the ways you install Ory software, and will roll this out to all other projects soon:

There is now one central brew / bash curl repository:

```patch
-brew install ory/kratos/kratos
+brew install ory/tap/kratos

-bash <(curl https://raw.githubusercontent.com/ory/kratos/master/install.sh)
+bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) kratos
```
  • Loading branch information
aeneasr authored Nov 8, 2021
1 parent 4d6bdb7 commit cf1714d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 375 deletions.
278 changes: 10 additions & 268 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,272 +1,14 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: kratos

env:
- GOPROXY=https://proxy.golang.org,direct

before:
hooks:
- go mod download
- go mod tidy
- go install github.com/CycloneDX/[email protected]

builds:
-
id: kratos-sqlite-darwin
flags:
- -tags
- sqlite
ldflags:
- -s -w -X github.com/ory/kratos/driver/config.Version={{.Tag}} -X github.com/ory/kratos/driver/config.Commit={{.FullCommit}} -X github.com/ory/kratos/driver/config.Date={{.Date}}
# - "-extldflags '-static'"
binary: kratos
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
goarch:
- amd64
goos:
- darwin
hooks:
post:
- cmd: cyclonedx-gomod app -licenses -json -output "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"
- cmd: ./.releaser/rename.sh "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"
-
id: kratos-sqlite-darwin-arm
flags:
- -tags
- sqlite
ldflags:
- -s -w -X github.com/ory/kratos/driver/config.Version={{.Tag}} -X github.com/ory/kratos/driver/config.Commit={{.FullCommit}} -X github.com/ory/kratos/driver/config.Date={{.Date}}
# - "-extldflags '-static'"
binary: kratos
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
goarch:
- arm64
goos:
- darwin
hooks:
post:
- cmd: cyclonedx-gomod app -licenses -json -output "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"
- cmd: ./.releaser/rename.sh "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"
-
id: kratos-sqlite-linux
flags:
- -tags
- sqlite
ldflags:
- -s -w -X github.com/ory/kratos/driver/config.Version={{.Tag}} -X github.com/ory/kratos/driver/config.Commit={{.FullCommit}} -X github.com/ory/kratos/driver/config.Date={{.Date}}
binary: kratos
env:
- CGO_ENABLED=1
goarch:
- amd64
goos:
- linux
hooks:
post:
- cmd: cyclonedx-gomod app -licenses -json -output "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"
- cmd: ./.releaser/rename.sh "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"
-
id: kratos-sqlite-linux-libmusl
flags:
- -tags
- sqlite
ldflags:
- -s -w -X github.com/ory/kratos/driver/config.Version={{.Tag}} -X github.com/ory/kratos/driver/config.Commit={{.FullCommit}} -X github.com/ory/kratos/driver/config.Date={{.Date}}
binary: kratos
env:
- CGO_ENABLED=1
- CC=musl-gcc
goarch:
- amd64
goos:
- linux
hooks:
post:
- cmd: cyclonedx-gomod app -licenses -json -output "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite-libmusl_{{ .Target }}.bom.json"
- cmd: ./.releaser/rename.sh "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite-libmusl_{{ .Target }}.bom.json"
-
id: kratos-sqlite-windows
flags:
- -tags
- sqlite
# Remove once https://github.com/golang/go/issues/40795 is closed
- -buildmode=exe
ldflags:
- -s -w -X github.com/ory/kratos/driver/config.Version={{.Tag}} -X github.com/ory/kratos/driver/config.Commit={{.FullCommit}} -X github.com/ory/kratos/driver/config.Date={{.Date}}
- "-extldflags '-static'"
binary: kratos
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
goarch:
- amd64
goos:
- windows
hooks:
post:
- cmd: cyclonedx-gomod app -licenses -json -output "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"
- cmd: ./.releaser/rename.sh "./dist/{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Target }}.bom.json"

-
id: kratos
ldflags:
- -s -w -X github.com/ory/kratos/driver/config.Version={{.Tag}} -X github.com/ory/kratos/driver/config.Commit={{.FullCommit}} -X github.com/ory/kratos/driver/config.Date={{.Date}}
binary: kratos
env:
- CGO_ENABLED=0
goarch:
- amd64
- 386
- arm
- arm64
goarm:
- 5
- 6
- 7
goos:
- linux
- windows
- darwin
hooks:
post:
- cmd: cyclonedx-gomod app -licenses -json -output "./dist/{{ .ProjectName }}_{{ .Version }}_{{ .Target }}.bom.json"
- cmd: ./.releaser/rename.sh "./dist/{{ .ProjectName }}_{{ .Version }}_{{ .Target }}.bom.json"

archives:
- id: kratos-sqlite
builds:
- kratos-sqlite-windows
- kratos-sqlite-darwin-arm
- kratos-sqlite-darwin
- kratos-sqlite-linux
replacements:
darwin: macos
386: 32bit
amd64: 64bit
arm: arm32
arm64: arm64
format_overrides:
-
goos: windows
format: zip
files:
- CHANGELOG.md
- LICENSE
- README.md
- SECURITY.md
name_template: "{{ .ProjectName }}_{{ .Version }}-sqlite_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
includes:
- from_url:
url: https://raw.githubusercontent.com/ory/xgoreleaser/master/build.tmpl.yml

- id: kratos-sqlite-libmusl
builds:
- kratos-sqlite-linux-libmusl
replacements:
darwin: macos
386: 32bit
amd64: 64bit
arm: arm32
format_overrides:
-
goos: windows
format: zip
files:
- CHANGELOG.md
- LICENSE
- README.md
- SECURITY.md
name_template: "{{ .ProjectName }}_{{ .Version }}-sqlite-libmusl_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
variables:
brew_name: kratos

- id: kratos
builds:
- kratos
replacements:
darwin: macos
386: 32bit
amd64: 64bit
arm: arm32
arm64: arm64
format_overrides:
- goos: windows
format: zip
files:
- CHANGELOG.md
- LICENSE
- README.md
- SECURITY.md
brew_description: "The Ory Kratos Identity Platform"

snapshot:
name_template: "{{ .Tag }}-next"
buildinfo_hash: "github.com/ory/kratos/driver/config.Commit"
buildinfo_tag: "github.com/ory/kratos/driver/config.Version"
buildinfo_date: "github.com/ory/kratos/driver/config.Date"

changelog:
sort: asc
filters:
exclude:
- ci skip
- Merge pull request
- Merge branch

brews:
- tap:
owner: ory
name: homebrew-tap
ids:
- kratos-sqlite
homepage: https://www.ory.sh
commit_author:
name: aeneasr
email: [email protected]
install: |
bin.install "kratos"
scoop:
bucket:
owner: ory
name: scoop-kratos
homepage: https://www.ory.sh
commit_author:
name: aeneasr
email: [email protected]

checksum:
algorithm: sha256
extra_files:
- glob: ./dist/*.bom.json

dockers:
- dockerfile: .docker/Dockerfile-sqlite
use: buildx
ids:
- kratos-sqlite-linux-libmusl
image_templates:
- "oryd/kratos:v{{ .Major }}-sqlite"
- "oryd/kratos:v{{ .Major }}.{{ .Minor }}-sqlite"
- "oryd/kratos:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}-sqlite"
- "oryd/kratos:{{.Tag}}-sqlite"
- "oryd/kratos:latest-sqlite"
- dockerfile: .docker/Dockerfile
use: buildx
ids:
- kratos
image_templates:
- "oryd/kratos:v{{ .Major }}"
- "oryd/kratos:v{{ .Major }}.{{ .Minor }}"
- "oryd/kratos:v{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
- "oryd/kratos:{{.Tag}}"
- "oryd/kratos:latest"

release:
prerelease: auto
name_template: "{{.Tag}}"
ids:
- kratos-sqlite
- kratos-sqlite-libmusl
- kratos
extra_files:
- glob: ./dist/*.bom.json
project_name: kratos
84 changes: 0 additions & 84 deletions .releaser/LICENSE.txt

This file was deleted.

20 changes: 0 additions & 20 deletions .releaser/rename.sh

This file was deleted.

Loading

0 comments on commit cf1714d

Please sign in to comment.