-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (65 loc) · 2.98 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: CI
on:
push:
branches:
- "*"
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17.0'
- name: Install dependencies
run: make dep
- name: Run vet, fmt, lint
run: make test
release:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.ref_type == 'tag' }}
steps:
- name: Set env
run: |
echo "CI_COMMIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
export CI_COMMIT_TAG=${GITHUB_REF#refs/*/}
- name: Checkout code
uses: actions/checkout@v2
- name: Build tarballs
run: make tarball
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ env.CI_COMMIT_TAG }}
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false
- name: Upload Darwin binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ github.event.repository.name }}-darwin-amd64-${{ env.CI_COMMIT_TAG }}.tar.gz
asset_name: ${{ github.event.repository.name }}-darwin-amd64-${{ env.CI_COMMIT_TAG }}.tar.gz
asset_content_type: application/x-mach-binary
- name: Upload Linux binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ github.event.repository.name }}-linux-amd64-${{ env.CI_COMMIT_TAG }}.tar.gz
asset_name: ${{ github.event.repository.name }}-linux-amd64-${{ env.CI_COMMIT_TAG }}.tar.gz
asset_content_type: application/x-executable
- name: Upload Windows binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ github.event.repository.name }}-windows-amd64-${{ env.CI_COMMIT_TAG }}.tar.gz
asset_name: ${{ github.event.repository.name }}-windows-amd64-${{ env.CI_COMMIT_TAG }}.tar.gz
asset_content_type: application/x-dosexec