Skip to content

Commit c313432

Browse files
committed
- [+] added GitHub Action to build releases
1 parent 54882e0 commit c313432

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Set up Go
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: 1.15
19+
20+
-
21+
name: Checkout
22+
uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
25+
26+
-
27+
name: Tests
28+
run: |
29+
export GOPATH=/home/runner/go
30+
mkdir -p $GOPATH/src/github.com/`dirname $GITHUB_REPOSITORY`
31+
mv $GITHUB_WORKSPACE $GOPATH/src/github.com/$GITHUB_REPOSITORY
32+
ln -s $GOPATH/src/github.com/$GITHUB_REPOSITORY $GITHUB_WORKSPACE
33+
# go mod tidy
34+
go get -v ./...
35+
go test -v ./...
36+
37+
-
38+
name: Run GoReleaser
39+
uses: goreleaser/goreleaser-action@v2
40+
if: success() && startsWith(github.ref, 'refs/tags/')
41+
with:
42+
version: latest
43+
args: release --rm-dist
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
project_name: jp
2+
3+
archives:
4+
- format: tar.gz
5+
wrap_in_directory: true
6+
format_overrides:
7+
- goos: windows
8+
format: zip
9+
# remove README and LICENSE
10+
files:
11+
- none*
12+
13+
builds:
14+
- env: [CGO_ENABLED=0]
15+
goos:
16+
- linux
17+
- windows
18+
- darwin
19+
goarch:
20+
- amd64
21+
- arm64
22+
23+
nfpms:
24+
- maintainer: Tong Sun <[email protected]>
25+
description: Cli program for JMESPath
26+
homepage: https://github.com/go-jsonfile/jp
27+
license: Apache 2.0
28+
formats:
29+
- deb
30+
- rpm
31+
- apk

0 commit comments

Comments
 (0)