-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (88 loc) · 3.65 KB
/
release.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Test and Release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
strategy:
matrix:
arch: [ amd64, arm64, 386 ]
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Checkout code
uses: actions/checkout@v2
#- name: Test
# run: make test
- name: Build
run: GOARCH=${{ matrix.arch }} go build -o sneak-${{ matrix.arch }} cmd/sneak/main.go
- name: Upload result
uses: actions/upload-artifact@v2-preview
with:
name: sneak-${{ matrix.arch }}
path: sneak-${{ matrix.arch }}
release:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Get tag name
id: get_tag_name
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# name the release with the run_id to allow multiple builds on the same branch/tag
# https://github.com/actions/create-release/issues/2#issuecomment-613591846
tag_name: ${{ steps.get_tag_name.outputs.VERSION }}
release_name: Release ${{ steps.get_tag_name.outputs.VERSION }}
draft: false
prerelease: false
- uses: actions/download-artifact@v1
with:
name: sneak-amd64
continue-on-error: true
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: ./sneak-amd64/sneak-amd64
asset_name: sneak-amd64
asset_content_type: application/octen-stream
continue-on-error: true
- uses: actions/download-artifact@v1
with:
name: sneak-arm64
continue-on-error: true
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: ./sneak-arm64/sneak-arm64
asset_name: sneak-arm64
asset_content_type: application/octen-stream
continue-on-error: true
- uses: actions/download-artifact@v1
with:
name: sneak-386
continue-on-error: true
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: ./sneak-386/sneak-386
asset_name: sneak-386
asset_content_type: application/octen-stream
continue-on-error: true