Skip to content

Commit

Permalink
Merge pull request #75 from maxpert/gh-build
Browse files Browse the repository at this point in the history
Adding support for MacOS releases
  • Loading branch information
maxpert authored Aug 2, 2023
2 parents debaa47 + 39599dd commit e4814f7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 31 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/go.yml

This file was deleted.

65 changes: 59 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ name: Release
on:
release:
types: [created]
push:
branches: [master]
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
build:
linux-build:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -54,14 +56,12 @@ jobs:
LDFLAGS: ${{ matrix.static && '-extldflags "-static"' || '' }}
SUFFIX: "${{ matrix.static && '-static' || ''}}"
VERSION: "${{ github.event_name == 'release' && github.event.release.name || github.sha }}"


steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-go@v2
- uses: actions/setup-go@v4
with:
go-version: '1.18'
go-version: '^1.20.7'

- name: Install cross-compilers
run: |
Expand Down Expand Up @@ -97,3 +97,56 @@ jobs:
asset_path: marmot-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}${{ env.SUFFIX }}.tar.gz
asset_name: marmot-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}${{ env.SUFFIX }}.tar.gz
asset_content_type: application/gzip
mac-build:
runs-on: macos-latest
strategy:
matrix:
include:
- arch: arm64
cc: gcc

- arch: amd64
cc: gcc
env:
GOOS: darwin
GOARCH: ${{ matrix.arch }}
CC: ${{ matrix.cc }}
LDFLAGS: ${{ matrix.static && '-extldflags "-static"' || '' }}
SUFFIX: "${{ matrix.static && '-static' || ''}}"
VERSION: "${{ github.event_name == 'release' && github.event.release.name || github.sha }}"
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: '^1.20.7'

- name: Build marmot
run: |
CGO_ENABLED=1 go build -o marmot .
tar -czvf marmot-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.SUFFIX }}.tar.gz marmot config.toml LICENSE README.md examples/*
- name: Upload binary artifact
uses: actions/upload-artifact@v2
with:
name: marmot-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.SUFFIX }}.tar.gz
path: marmot-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.SUFFIX }}.tar.gz
if-no-files-found: error

- name: Get release
id: release
uses: bruceadams/[email protected]
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload release tarball
uses: actions/[email protected]
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: marmot-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.SUFFIX }}.tar.gz
asset_name: marmot-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.SUFFIX }}.tar.gz
asset_content_type: application/gzip

0 comments on commit e4814f7

Please sign in to comment.