Skip to content

Commit

Permalink
Create go.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidChevallier authored Jul 11, 2024
1 parent 22a7818 commit a466687
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/go.yml
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

0 comments on commit a466687

Please sign in to comment.