1
0
forked from um/cli
cli/.github/workflows/build.yml

56 lines
1.4 KiB
YAML
Raw Normal View History

2021-02-21 16:14:53 +00:00
name: Build
on:
push:
branches: [ master ]
paths:
- "**/*.go"
- "go.mod"
- "go.sum"
2021-05-16 05:43:36 +00:00
- ".github/workflows/*.yml"
2021-02-21 16:14:53 +00:00
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
2021-05-16 04:30:48 +00:00
BIN_SUFFIX: ""
2021-02-21 16:14:53 +00:00
- os: macos-latest
2021-05-16 04:30:48 +00:00
BIN_SUFFIX: ""
2021-02-21 16:14:53 +00:00
- os: windows-latest
2021-05-16 04:30:48 +00:00
BIN_SUFFIX: ".exe"
2021-02-21 16:14:53 +00:00
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
2021-05-16 04:30:48 +00:00
run: |
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
2021-05-16 05:41:13 +00:00
echo "::set-output name=git_tag::$(git describe --tags --always)"
2021-02-21 16:14:53 +00:00
- name: Build
env:
CGO_ENABLED: 0
2021-05-16 04:30:48 +00:00
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
2021-02-21 16:14:53 +00:00
- name: Publish artifact
uses: actions/upload-artifact@v2
with:
name: um-${{ runner.os }}${{ matrix.BIN_SUFFIX }}
path: ./um-${{ runner.os }}${{ matrix.BIN_SUFFIX }}