Skip to content

chore(ci): build, test, release + installer ready #13

chore(ci): build, test, release + installer ready

chore(ci): build, test, release + installer ready #13

Workflow file for this run

name: Build
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_call:
inputs:
create_release:
description: 'Check if workflows called from Github Release event.'
default: false
required: false
type: boolean
jobs:
go-build:
name: Run Go Build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.21.x]
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: "go.sum"
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
id: build
run: |
output_name=world-cli_${{ matrix.goos }}_${{ matrix.goarch }}
[ ${{ matrix.goos }} = "windows" ] && output_name+=".exe"
env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o $output_name
echo "output_name=$output_name" >> $GITHUB_OUTPUT
- name: Compress Build Binary
uses: a7ul/[email protected]
id: compress
with:
command: c
files: |
./${{ steps.build.outputs.output_name }}
outPath: ${{ steps.build.outputs.output_name }}.tar.gz
- name: Upload binary to Github artifact
if: ${{ inputs.create_release }}
uses: actions/upload-artifact@v3
with:
name: world-cli-${{ matrix.goos }}-${{ matrix.goarch }}
path: ./world-cli*.tar.gz