Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit 0cb9e49

Browse files
committed
github actions
1 parent dcdee0c commit 0cb9e49

File tree

1 file changed

+51
-17
lines changed

1 file changed

+51
-17
lines changed

.github/workflows/go.yml

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
name: go
1+
---
2+
name: build binary
23

34
on:
45
push:
5-
branches: [ master ]
6+
branches:
7+
- master
8+
tags:
9+
- v*
610
pull_request:
7-
branches: [ master ]
11+
branches:
12+
- master
813
workflow_dispatch:
914

1015
jobs:
@@ -13,21 +18,50 @@ jobs:
1318
runs-on: ubuntu-latest
1419
steps:
1520

16-
- name: set up go
17-
uses: actions/setup-go@v2
18-
with:
19-
go-version: ^1.15
20-
id: go
21+
- name: set up go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ^1.15
2125

22-
- name: check out to go module directory
23-
uses: actions/checkout@v2
26+
- name: check out to go module directory
27+
uses: actions/checkout@v2
2428

25-
- name: get dependencies
26-
run: |
27-
go get -v -t -d ./...
29+
- name: get dependencies
30+
run: go get -v -t -d ./...
2831

29-
- name: build
30-
run: go build -v .
32+
- name: build
33+
run: go build -v .
3134

32-
- name: test
33-
run: go test -v .
35+
- name: upload binary as artifact
36+
uses: actions/upload-artifact@v2
37+
with:
38+
path: ./processor_reducer
39+
name: processor_reducer
40+
if-no-files-found: error
41+
push:
42+
name: create and publish release
43+
runs-on: ubuntu-latest
44+
needs: build
45+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
46+
steps:
47+
48+
- name: create release
49+
id: create_release
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
tag_name: ${{ github.ref }}
55+
release_name: Release ${{ github.ref }}
56+
draft: true
57+
prerelease: false
58+
59+
- name: upload release asset
60+
uses: actions/upload-release-asset@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
upload_url: ${{ steps.create_release.outputs.upload_url }}
65+
asset_path: ./processor_reducer
66+
asset_name: processor_reducer
67+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)