glider/.github/workflows/build.yml

44 lines
1.3 KiB
YAML
Raw Normal View History

name: Build
2022-01-26 22:31:56 +08:00
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
2020-04-03 22:54:13 +08:00
- name: Checkout
uses: actions/checkout@v2
2021-09-14 00:56:10 +08:00
with:
fetch-depth: 0
2022-01-26 22:31:56 +08:00
2021-09-14 00:56:10 +08:00
- name: Get Go version
run: |
echo "GO_VERSION=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | grep $(grep -P "go \d+\." go.mod | cut -d " " -f2) | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g')" >> $GITHUB_ENV
2022-01-26 22:31:56 +08:00
2020-04-03 22:54:13 +08:00
- name: Set up Go
2021-02-06 00:26:58 +08:00
uses: actions/setup-go@v2
2020-04-03 22:54:13 +08:00
with:
2022-01-26 23:40:49 +08:00
stable: 'false'
go-version: '1.18.0-beta1'
# go-version: ${{ env.GO_VERSION}}
2022-01-26 22:31:56 +08:00
2021-09-14 00:56:10 +08:00
- name: Test
run: go test -v .
2022-01-26 22:31:56 +08:00
2020-04-03 22:54:13 +08:00
- name: Build
2022-01-26 22:31:56 +08:00
uses: goreleaser/goreleaser-action@v2
if: "!startsWith(github.ref, 'refs/tags/')"
with:
version: latest
args: build --snapshot --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2022-01-26 23:40:49 +08:00
- name: Release
2021-09-14 00:56:10 +08:00
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}