Added completion command #5
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
name: Build and Release Go Binaries | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' # Triggers on version tags like v1.0.0 | |
jobs: | |
build: | |
name: Build Go binaries | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, darwin] | |
goarch: [amd64, arm64] | |
exclude: | |
- goos: linux | |
goarch: arm64 | |
- goos: darwin | |
goarch: amd64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.4' | |
- name: Build binary | |
run: | | |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./bin/kubecnf_${{ matrix.goos }}_${{ matrix.goarch }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kubecnf-${{ matrix.goos }}-${{ matrix.goarch }} | |
path: ./bin/kubecnf_${{ matrix.goos }}_${{ matrix.goarch }} | |
release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download binaries (Linux amd64) | |
uses: actions/download-artifact@v3 | |
with: | |
name: kubecnf-linux-amd64 | |
path: ./bin | |
- name: Download binaries (Darwin arm64) | |
uses: actions/download-artifact@v3 | |
with: | |
name: kubecnf-darwin-arm64 | |
path: ./bin | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Assets (Linux amd64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/kubecnf_linux_amd64 | |
asset_name: kubecnf_linux_amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload Release Assets (Darwin arm64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./bin/kubecnf_darwin_arm64 | |
asset_name: kubecnf_darwin_arm64 | |
asset_content_type: application/octet-stream | |