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
|
2022-04-03 17:58:26 +08:00
|
|
|
- uses: actions/setup-go@v3
|
2020-07-17 09:05:25 +08:00
|
|
|
with:
|
2022-04-03 17:58:26 +08:00
|
|
|
go-version: '^1.18.0'
|
2020-07-17 09:05:25 +08:00
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
2022-03-02 12:43:41 +08:00
|
|
|
uses: actions/checkout@v3
|
2020-07-17 09:05:25 +08:00
|
|
|
|
|
|
|
- name: Cache go module
|
2022-03-26 09:54:29 +08:00
|
|
|
uses: actions/cache@v3
|
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
|
2021-12-17 16:19:51 +08:00
|
|
|
run: make -j releases && make sha256sum
|
2020-07-17 09:05:25 +08:00
|
|
|
|
|
|
|
- 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
|
|
|
|
2021-12-16 12:12:46 +08:00
|
|
|
- uses: actions/upload-artifact@v2
|
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
|