-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22a7818
commit a466687
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Go Multiarch Build and Release | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
goos: [linux, darwin, windows] | ||
goarch: [amd64, arm64] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.22.4" | ||
|
||
- name: Build | ||
run: | | ||
mkdir -p dist | ||
EXT="" | ||
if [ "${{ matrix.goos }}" == "windows" ]; then EXT=".exe"; fi | ||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/crdtokcl-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} . | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: crdtokcl-${{ matrix.goos }}-${{ matrix.goarch }} | ||
path: dist/crdtokcl-${{ matrix.goos }}-${{ matrix.goarch }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download binaries | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: dist | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: Release ${{ github.ref_name }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: dist/ | ||
asset_name: crdtokcl-${{ matrix.goos }}-${{ matrix.goarch }} | ||
asset_content_type: application/octet-stream |