generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 116
77 lines (76 loc) · 2.55 KB
/
build-and-publish.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
name: Build and Publish Nighthawk Binaries
on:
workflow_dispatch:
inputs:
version:
description: 'Version of GetNighthawk to be released'
required: true
default: 'stable'
nighthawk_version:
description: 'Version of Nighthawk to build'
required: true
default: 'main'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Setup Release Assets
id: create_release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/') && success()
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
tag: ${{ github.event.inputs.version }}
name: GetNighthawk ${{ github.event.inputs.version }}
allowUpdates: true
omitNameDuringUpdate: true
replacesArtifacts: true
build-and-publish:
name: Build and Publish Nighthawk
needs: [release]
strategy:
max-parallel: 10
matrix:
os: [ubuntu-latest,]
architecture: [amd64]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Nighthawk
uses: actions/checkout@v2
with:
repository: 'envoyproxy/nighthawk'
ref: ${{ github.event.inputs.nighthawk_version }}
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: '^1.13.1'
- name: Build and Publish Assets
uses: layer5io/getnighthawk@master
with:
repo: layer5io/getnighthawk
version: ${{ github.event.inputs.version }}
token: ${{ secrets.GH_ACCESS_TOKEN }}
os: ${{ matrix.os }}
architecture: ${{ matrix.architecture }}
- name: Login to Docker
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success()
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout GetNighthawk
uses: actions/checkout@v2
with:
repository: 'layer5io/getnighthawk'
- name: Build and Tag Docker Image
run: |
chmod +x ./ci/docker_build.sh
./ci/docker_build.sh
docker tag envoyproxy/nighthawk-dev:latest ${{ secrets.IMAGE_NAME }}:latest
docker tag ${{ secrets.IMAGE_NAME }}:latest ${{ secrets.IMAGE_NAME }}:${{ github.event.inputs.version }}
- name: Push Docker Image
run: |
docker push ${{ secrets.IMAGE_NAME }}:latest
docker push ${{ secrets.IMAGE_NAME }}:${{ github.event.inputs.version }}