-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from maxpert/gh-build
Adding support for MacOS releases
- Loading branch information
Showing
2 changed files
with
59 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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: | | ||
|
@@ -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 |