-
Notifications
You must be signed in to change notification settings - Fork 77
112 lines (98 loc) · 3.05 KB
/
build.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
check-latest: true
cache: true
- name: Test
run: go test ./...
containerize:
runs-on: ubuntu-latest
permissions:
packages: write
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ghcr.io/bloodhoundad/azurehound
tags: |
type=edge,branch=main
- name: Build Container Image
uses: docker/build-push-action@v3
with:
context: .
build-args: VERSION=v0.0.0-rolling+${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ ! startsWith(github.event_name, 'pull_request') }}
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
os:
- darwin
- linux
- windows
arch:
- amd64
- arm64
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
check-latest: true
cache: true
- name: Build
run: 'go build -ldflags="-s -w -X github.com/bloodhoundad/azurehound/v2/constants.Version=v0.0.0-rolling+${{ github.sha }}"'
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- name: Zip
if: "! startsWith(github.event_name, 'pull_request')"
run: 7z a -tzip -mx9 azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip azurehound*
- name: Compute Checksum
if: "! startsWith(github.event_name, 'pull_request')"
run: sha256sum azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip > azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip.sha256
- name: Update Rolling Release
if: "! startsWith(github.event_name, 'pull_request')"
uses: softprops/action-gh-release@v1
with:
name: Rolling Release (unstable)
tag_name: rolling
prerelease: true
files: |
azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip
azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip.sha256
body: |
Rolling release of AzureHound compiled from source (${{ github.sha }})
This is automatically kept up-to-date with the `${{ github.ref_name }}` ${{ github.ref_type }}