Skip to content

Commit

Permalink
feat: added darwin binary
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Feb 10, 2024
1 parent b6d153b commit 8dbc255
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 11 deletions.
60 changes: 49 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
fetch-depth: 0
- name: gcc install
run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu
#- name: Get tag
# uses: little-core-labs/get-git-tag@v3.0.2
# id: tag
- name: Set up Go
uses: actions/setup-go@v5
with:
Expand Down Expand Up @@ -57,9 +54,49 @@ jobs:
dist/checksums.txt
dist/CHANGELOG.md
build-darwin-binary:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: gcc install
run: sudo apt-get update; sudo apt install gcc-aarch64-linux-gnu
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache code
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
"%LocalAppData%\\go-build" # Build cache (Windows)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --skip=publish --verbose --config .goreleaser-for-darwin.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: alert_system_darwin
path: |
dist/alert_system_*.zip
dist/checksums.txt
dist/CHANGELOG.md
create-release:
#needs: [build-linux-binary, build-darwin-binary, build-windows-binary]
needs: [build-linux-binary]
needs: [build-linux-binary, build-darwin-binary]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -76,11 +113,11 @@ jobs:
with:
name: alert_system_linux
path: ./tmp-build/linux
#- name: Download darwin binaries
# uses: actions/download-artifact@v3
# with:
# name: kubectl-eds-darwin
# path: ./tmp-build/darwin
- name: Download darwin binaries
uses: actions/download-artifact@v4
with:
name: alert_system_darwin
path: ./tmp-build/darwin
#- name: Download windows binaries
# uses: actions/download-artifact@v3
# with:
Expand All @@ -93,17 +130,18 @@ jobs:
run: |
mkdir -p ./dist
mv ./tmp-build/linux/*.zip ./dist
mv ./tmp-build/darwin/*.zip ./dist
cat ./tmp-build/linux/checksums.txt >> ./dist/checksums.txt
cat ./tmp-build/linux/CHANGELOG.md >> ./dist/CHANGELOG.md
#- name: Generate Plugin manifest
# run: ./hack/release/generate-plugin-manifest.sh ${{steps.tag.outputs.tag}}
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: dist/CHANGELOG.md
prerelease: ${{ contains(github.ref, '-rc.') }}
files: |
dist/*.zip
dist/checksums.txt
dist/CHANGELOG.md
env:
COMMIT_TAG: ${{steps.tag.outputs.tag}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 changes: 65 additions & 0 deletions .goreleaser-for-darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Make sure to check the documentation at http://goreleaser.com
# ---------------------------
# General
# ---------------------------
before:
hooks:
- make all
snapshot:
name_template: "{{ .Tag }}"
changelog:
sort: asc
filters:
exclude:
- '^.github:'
- '^.vscode:'
- '^docs:'
- '^test:'

# ---------------------------
# Builder
#
# CGO is enabled and inspiration came from:
# https://github.com/goreleaser/goreleaser-cross-example
# https://github.com/goreleaser/goreleaser-cross-example-sysroot
# https://github.com/DataDog/extendeddaemonset/blob/main/.goreleaser-for-linux.yaml
# ---------------------------
builds:
- id: darwin-build
main: ./cmd/
binary: alert_system
goos:
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=1
#- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64
#- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig
#- CC=o64-clang # (GitHub action)
#- CXX=o64-clang++ # (GitHub action)
#- CC=clang # Changed from o64-clang (works for mac)
#- CXX=clang++ # Changed from o64-clang++ (works for mac)
#mod_timestamp: "{{ .CommitTimestamp }}"
#flags:
# - -mod=readonly
ldflags:
- -s -w -X main.version={{.Version}}
#- -s -w -X github.com/bitcoin-sv/{{ .ProjectName }}/cmd.Version={{ .Version }}

# ---------------------------
# Archives + Checksums
# ---------------------------
archives:
- id: alert_system
builds:
- darwin-build
name_template: "alert_system_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
files:
- LICENSE
checksum:
name_template: "checksums.txt"
algorithm: sha256

0 comments on commit 8dbc255

Please sign in to comment.