1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-23 05:39:03 +08:00
nali/.github/workflows/go.yml

51 lines
1.2 KiB
YAML
Raw Normal View History

2020-07-17 09:05:25 +08:00
name: Go
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Go
2020-07-17 11:49:49 +08:00
uses: actions/setup-go@v2
2020-07-17 09:05:25 +08:00
with:
2020-07-17 11:49:49 +08:00
go-version: 1.14.x
2020-07-17 09:05:25 +08:00
- name: Check out code into the Go module directory
uses: actions/checkout@v2.3.3
2020-07-17 09:05:25 +08:00
- name: Cache go module
2020-07-17 11:49:49 +08:00
uses: actions/cache@v2
2020-07-17 09:05:25 +08:00
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
2020-07-17 11:49:49 +08:00
- name: Get dependencies and run test
run: |
go test ./...
2020-07-17 09:05:25 +08:00
- name: Build
2020-07-17 18:07:20 +08:00
if: startsWith(github.ref, 'refs/tags/')
2020-07-17 09:05:25 +08:00
env:
NAME: nali
BINDIR: bin
run: make -j releases
- name: Upload Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: bin/*
draft: true
prerelease: true
2020-07-17 11:49:49 +08:00
- uses: actions/upload-artifact@v2.2.0
2020-07-17 11:52:37 +08:00
if: startsWith(github.ref, 'refs/tags/')
2020-07-17 11:49:49 +08:00
with:
name: build
path: bin