Skip to content

Create go.yml

Create go.yml #1

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:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
name: Build, Test and Package on All Platforms
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.5'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Package
run: |
mkdir -p release
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
tar -czvf release/${{ github.repository }}_${{ github.run_number }}_linux_amd64.tar.gz ./*
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
tar -czvf release/${{ github.repository }}_${{ github.run_number }}_darwin_amd64.tar.gz ./*
else
zip -r release\\${{ github.repository }}_${{ github.run_number }}_windows_amd64.zip .\\*
shell: bash
- name: Upload Release Assets
uses: actions/upload-artifact@v3
with:
name: release
path: release