Skip to content

Create go.yml

Create go.yml #1

Workflow file for this run

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