Jelajahi Sumber

goreleaser w/ notarization

Alexander Belanger 5 tahun lalu
induk
melakukan
fada1cb31c
3 mengubah file dengan 53 tambahan dan 1 penghapusan
  1. 35 0
      .darwin.goreleaser.yml
  2. 2 1
      .gitignore
  3. 16 0
      scripts/release.sh

+ 35 - 0
.darwin.goreleaser.yml

@@ -0,0 +1,35 @@
+before:
+  hooks:
+    - go mod download
+builds:
+  - id: "porter-cli"
+    binary: porter
+    env:
+      - CGO_ENABLED=1
+    dir: cli
+    main: ./main.go
+    goos:
+      - darwin
+    goarch:
+      - amd64
+    flags:
+      - -tags=cli
+    hooks:
+      post: gon gon.hcl
+archives:
+  - replacements:
+      darwin: Darwin
+      linux: Linux
+      windows: Windows
+      386: i386
+      amd64: x86_64
+checksum:
+  name_template: 'checksums.txt'
+snapshot:
+  name_template: "{{ .Tag }}-next"
+changelog:
+  sort: asc
+  filters:
+    exclude:
+      - '^docs:'
+      - '^test:'

+ 2 - 1
.gitignore

@@ -3,4 +3,5 @@
 app
 *.db
 test.yaml
-dist
+dist
+gon.hcl

+ 16 - 0
scripts/release.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Step 0 -- ensure that:
+# (1) GITHUB_TOKEN exists as an env variable
+# (2) Apple ID password exists in keychain
+
+# Step 1 -- build for linux/windows inside a docker container
+docker run --rm --privileged \
+-v $PWD:/go/src/github.com/porter-dev/porter \
+-v /var/run/docker.sock:/var/run/docker.sock \
+-w /go/src/github.com/porter-dev/porter \
+-e GORELEASER_GITHUB_TOKEN='$GITHUB_TOKEN' \
+mailchain/goreleaser-xcgo "--rm-dist"
+
+# Step 2 -- build for MacOS using notarization tool
+goreleaser --config .darwin.goreleaser.yml