cli/.github/workflows/build.yml
Emmm Monster b517806fdb
Fix CI
2021-05-16 13:43:36 +08:00

56 lines
1.4 KiB
YAML

name: Build
on:
push:
branches: [ master ]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
- ".github/workflows/*.yml"
pull_request:
branches: [ master ]
types: [ opened, synchronize, reopened ]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest ]
include:
- os: ubuntu-latest
BIN_SUFFIX: ""
- os: macos-latest
BIN_SUFFIX: ""
- os: windows-latest
BIN_SUFFIX: ".exe"
steps:
- name: Checkout codebase
uses: actions/checkout@v2
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
- name: Setup vars
id: vars
run: |
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
echo "::set-output name=git_tag::$(git describe --tags --always)"
- name: Build
env:
CGO_ENABLED: 0
run: go build -trimpath -ldflags="-w -s -X main.AppVersion=${{ steps.vars.outputs.git_tag }}" -v -o um-${{ runner.os }}${{ matrix.BIN_SUFFIX }} ./cmd/um
- name: Publish artifact
uses: actions/upload-artifact@v2
with:
name: um-${{ runner.os }}${{ matrix.BIN_SUFFIX }}
path: ./um-${{ runner.os }}${{ matrix.BIN_SUFFIX }}