-
Notifications
You must be signed in to change notification settings - Fork 7
129 lines (128 loc) · 3.67 KB
/
build.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: "Build"
on:
push:
branches:
- main
tags:
- "*.*.*"
- "v*.*.*"
- "*.*.*-*"
- "v*.*.*-*"
paths:
- "go.mod"
- "go.sum"
- "cmd/**"
- "pkg/**"
- "Dockerfile"
- "Makefile"
pull_request:
paths:
- "go.mod"
- "go.sum"
- "cmd/**"
- "pkg/**"
- "Dockerfile"
- "Makefile"
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- name: triggered sha
run: |
VERSION="${GITHUB_SHA}:noavx"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: tagged version
if: startsWith( github.ref, 'refs/tags/')
run: |
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
VERSION="${tag_name}:noavx"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Build
run: |
sudo make ngt/install
make VERSION=${VERSION}
- name: Zip
run: |
zip --junk-paths alvd-linux-amd64.zip cmd/alvd/alvd
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: alvd-linux-amd64.zip
path: ./alvd-linux-amd64.zip
build-linux-avx2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.3'
- name: triggered sha
run: |
VERSION="${GITHUB_SHA}:avx2"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: tagged version
if: startsWith( github.ref, 'refs/tags/')
run: |
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
VERSION="${tag_name}:avx2"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Build
run: |
sudo make NGT_BUILD_OPTIONS='' ngt/install
make VERSION=${VERSION}
- name: Zip
run: |
zip --junk-paths alvd-linux-amd64-avx2.zip cmd/alvd/alvd
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: alvd-linux-amd64-avx2.zip
path: ./alvd-linux-amd64-avx2.zip
release:
runs-on: ubuntu-latest
needs:
- build-linux
- build-linux-avx2
if: startsWith( github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v1
- name: Create release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- uses: actions/download-artifact@v1
with:
name: alvd-linux-amd64.zip
path: tmp
- name: Upload Release Asset (linux)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tmp/alvd-linux-amd64.zip
asset_name: alvd-linux-amd64.zip
asset_content_type: application/zip
- uses: actions/download-artifact@v1
with:
name: alvd-linux-amd64-avx2.zip
path: tmp
- name: Upload Release Asset (linux-static)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tmp/alvd-linux-amd64-avx2.zip
asset_name: alvd-linux-amd64-avx2.zip
asset_content_type: application/zip