-
Notifications
You must be signed in to change notification settings - Fork 70
80 lines (76 loc) · 2.3 KB
/
release.yaml
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
---
name: Release
on:
push:
tags: [ "*" ]
jobs:
build:
name: Build
strategy:
matrix:
version: [1.19.x]
target:
- { os: 'darwin', platform: 'macos-latest', arch: 'amd64' }
- { os: 'linux', platform: 'ubuntu-latest', arch: 'amd64' }
- { os: 'windows', platform: 'windows-latest', arch: 'amd64' }
runs-on: ${{ matrix.target.platform }}
steps:
- name: Set up toolchain
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.version }}
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Build binary
run: go build -o certigo .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: certigo-${{ matrix.target.os }}-${{ matrix.target.arch }}
path: certigo
release:
name: Create release
runs-on: ubuntu-latest
needs: [ build ]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "Release Build (Draft)"
body: "Release Build (from ${{ github.ref }}/${{ github.sha }})"
draft: true
prerelease: true
add-assets:
name: Add assets
runs-on: ubuntu-latest
needs: [ build, release ]
strategy:
matrix:
target:
- { os: 'darwin', arch: 'amd64' }
- { os: 'linux', arch: 'amd64' }
- { os: 'windows', arch: 'amd64' }
steps:
- uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: certigo-${{ matrix.target.os }}-${{ matrix.target.arch }}
path: dist
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./dist/certigo
asset_name: certigo-${{ matrix.target.os }}-${{ matrix.target.arch }}
asset_content_type: application/octet-stream