Skip to content

Go

Go #10

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
workflow_dispatch:
inputs:
tag_name:
description: 'tag name'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
- run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/${{ github.event.repository.name }}_linux_x64 .
- run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o bin/${{ github.event.repository.name }}_win_x64.exe
- run: CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o bin/${{ github.event.repository.name }}_win_arm64.exe .
- run: CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o bin/${{ github.event.repository.name }}_darwin_x64 .
- run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/${{ github.event.repository.name }}_darwin_arm64 .
- name: Release
uses: softprops/action-gh-release@v1
with: # 将下述可执行文件 release 上去
tag_name: ${{ github.event.inputs.tag_name }}
files: bin/*
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}