chore: update build script

This commit is contained in:
soulteary 2023-01-09 23:58:39 +08:00
parent 1890fe8d08
commit 267b187cb8
No known key found for this signature in database
GPG key ID: 8107DBA6BC84D986
3 changed files with 58 additions and 24 deletions

3
.github/FUNDING.yml vendored
View file

@ -1,3 +0,0 @@
# These are supported funding model platforms
open_collective: webhook

View file

@ -1,2 +0,0 @@
<!-- Love webhook? Please consider supporting our collective:
👉 https://opencollective.com/webhook/donate -->

View file

@ -1,23 +1,62 @@
name: build name: Release
on: [push, pull_request]
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
env:
GO_VERSION: 1.19
jobs: jobs:
build: build:
strategy: runs-on: ubuntu-latest
matrix: env:
go-version: [1.14.x, 1.15.x] GO111MODULE: on
os: [ubuntu-latest, macos-latest, windows-latest] DOCKER_CLI_EXPERIMENTAL: "enabled"
runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 -
- uses: actions/setup-go@v2 name: Checkout
uses: actions/checkout@v3
with: with:
go-version: ${{ matrix.go-version }} fetch-depth: 0
id: go -
name: Set up Go
- name: Build uses: actions/setup-go@v3
run: go build -v with:
go-version: ${{ env.GO_VERSION }}
- name: Test -
run: go test -v ./... name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Tests
run: |
go mod tidy
go test -v ./...
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}