Skip to content

Commit

Permalink
adding support for go releaser
Browse files Browse the repository at this point in the history
* signing arm and amd
  • Loading branch information
Ryan Svihla committed Mar 16, 2021
1 parent 137f8b3 commit 14628db
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: goreleaser

on:
push:
tags:
- '*'
jobs:
goreleaser:
runs-on: macos-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: install gon
run: brew tap mitchellh/gon && brew install mitchellh/gon/gon
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ bin/
# Dependency directories (remove the comment below to include it)
# vendor/
.DS_Store

dist/
38 changes: 38 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
builds:
- id: astra-cli
goos:
- windows
- linux
goarch:
- amd64
- arm64
- id: astra-cli-osx-amd
binary: astra-cli
goos:
- darwin
goarch:
- amd64
hooks:
post: gon gon_osx_darwin_amd64.hcl
- id: astra-cli-osx-arm
binary: astra-cli
goos:
- darwin
goarch:
- arm64
hooks:
post: gon gon_osx_darwin_arm64.hcl
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
extra_files:
- - glob: ./dist/*.zip
9 changes: 8 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
package cmd

import (
"fmt"
"os"

"github.com/rsds143/astra-cli/pkg/env"
"github.com/spf13/cobra"
)
Expand All @@ -32,6 +35,10 @@ var RootCmd = &cobra.Command{
Short: "An easy to use client for automating DataStax Astra",
Long: `Manage and provision databases on DataStax Astra
Complete documentation is available at https://github.com/rsds143/astra-cli`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(cobraCmd *cobra.Command, args []string) {
if err := cobraCmd.Usage(); err != nil {
fmt.Printf("warn unable to show usage %v\n", err)
os.Exit(1)
}
},
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.16

require (
github.com/rsds143/astra-devops-sdk-go v0.3.0
github.com/spf13/cobra v1.1.3 // indirect
github.com/spf13/cobra v1.1.3
)
14 changes: 14 additions & 0 deletions gon_osx_darwin_amd64.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
source = ["./dist/astra-cli-osx-amd_darwin_amd64/astra-cli"]
bundle_id = "pro.foundev.astra.cli"

sign {
application_identity = "Developer ID Application: Ryan Svihla (8FLL83XJM2)"
}

zip {
output_path = "./dist/astra-cli-osx-amd64-signed.zip"
}

apple_id {
password = "@env:AC_PASSWORD"
}
14 changes: 14 additions & 0 deletions gon_osx_darwin_arm64.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
source = ["./dist/astra-cli-osx-arm_darwin_arm64/astra-cli"]
bundle_id = "pro.foundev.astra.cli"

sign {
application_identity = "DDF52A8D387B7E77F18F86043FF2AC7AED277179"
}

zip {
output_path = "./dist/astra-cli-osx-arm-signed.zip"
}

apple_id {
password = "@env:AC_PASSWORD"
}

0 comments on commit 14628db

Please sign in to comment.