2021-10-11 20:08:18 +08:00
|
|
|
name: Release
|
|
|
|
on: [push]
|
2019-08-15 11:40:40 +08:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2019-10-14 10:40:00 +08:00
|
|
|
- name: Setup Go
|
2022-07-21 15:15:14 +08:00
|
|
|
uses: actions/setup-go@v3
|
2019-08-15 11:40:40 +08:00
|
|
|
with:
|
2022-07-21 15:15:14 +08:00
|
|
|
check-latest: true
|
|
|
|
go-version: '1.18'
|
2019-08-15 11:40:40 +08:00
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
2022-03-06 21:48:25 +08:00
|
|
|
uses: actions/checkout@v3
|
2020-06-04 10:38:30 +08:00
|
|
|
|
2019-11-06 12:05:18 +08:00
|
|
|
- name: Cache go module
|
2020-06-04 10:38:30 +08:00
|
|
|
uses: actions/cache@v2
|
2019-11-06 12:05:18 +08:00
|
|
|
with:
|
2022-04-14 23:37:41 +08:00
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
2019-11-06 12:05:18 +08:00
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2019-08-15 11:40:40 +08:00
|
|
|
|
2021-10-11 20:08:18 +08:00
|
|
|
- name: Get dependencies, run test
|
2019-08-15 11:40:40 +08:00
|
|
|
run: |
|
|
|
|
go test ./...
|
2019-10-14 10:40:00 +08:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
env:
|
|
|
|
NAME: clash
|
|
|
|
BINDIR: bin
|
|
|
|
run: make -j releases
|
|
|
|
|
|
|
|
- name: Upload Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: bin/*
|
|
|
|
draft: true
|