Skip to content

Commit

Permalink
chore(ci): add init multiplatform build
Browse files Browse the repository at this point in the history
  • Loading branch information
heronimus committed Oct 19, 2023
1 parent 2247617 commit 049623b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
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:
Expand All @@ -16,6 +22,8 @@ jobs:
strategy:
matrix:
go-version: [1.21.x]
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -26,14 +34,17 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: "go.sum"
- name: Build
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
run: |
go build
- name: Run build binary
run: |
./world-cli version
- name: Upload binary Github artifact
output_name=world-cli_${{ matrix.goos }}_${{ matrix.goarch }}
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o $output_name
- name: Upload binary to Github artifact
if: ${{ inputs.create_release }}
uses: actions/upload-artifact@v3
with:
name: world-cli
path: ./world-cli
name: world-cli-${{ matrix.goos }}-${{ matrix.goarch }}
path: ./world-cli*
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
go-build:
name: Build
uses: ./.github/workflows/build.yml
with:
create_release: true

release:
name: Release world-cli binary
Expand All @@ -23,11 +25,9 @@ jobs:
steps:
- name: Download world-cli build binary
uses: actions/download-artifact@v3
with:
name: world-cli
- name: Publish world-cli binary to corresponding Github Release
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'world-cli'
args: 'world-cli*'

0 comments on commit 049623b

Please sign in to comment.