Skip to content

Commit c89c9a3

Browse files
authored
Merge pull request #113 from SpecterOps/workflow-s3-test
Workflow testing
2 parents ce5baec + beee363 commit c89c9a3

File tree

1 file changed

+71
-12
lines changed

1 file changed

+71
-12
lines changed

.github/workflows/publish.yml

+71-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
name: Publish
22

33
on:
4-
push:
4+
push:
55
tags:
6-
- "v*.*.*"
7-
6+
- v*.*.*
7+
env:
8+
AZUREHOUND_VERSION: ${{ github.ref_name }}
89
jobs:
910
build:
1011
runs-on: ubuntu-latest
11-
defaults:
12-
run:
13-
shell: bash
1412
strategy:
1513
matrix:
1614
os:
@@ -21,7 +19,7 @@ jobs:
2119
- amd64
2220
- arm64
2321
steps:
24-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2523

2624
- name: Setup Go
2725
uses: actions/setup-go@v3
@@ -31,11 +29,18 @@ jobs:
3129
cache: true
3230

3331
- name: Build
34-
run: 'go build -ldflags="-s -w -X github.com/bloodhoundad/azurehound/v2/constants.Version=${{ github.ref_name }}"'
32+
run: 'go build -ldflags="-s -w -X github.com/bloodhoundad/azurehound/v2/constants.Version=${{ env.AZUREHOUND_VERSION }}"'
3533
env:
3634
GOOS: ${{ matrix.os }}
3735
GOARCH: ${{ matrix.arch }}
3836

37+
- name: Upload as Artifact
38+
if: matrix.os == 'windows'
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: azurehound-bin-${{ matrix.os }}-${{ matrix.arch }}
42+
path: azurehound*
43+
3944
- name: Zip
4045
run: 7z a -tzip -mx9 azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip azurehound*
4146

@@ -49,15 +54,69 @@ jobs:
4954
azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip
5055
azurehound-${{ matrix.os }}-${{ matrix.arch }}.zip.sha256
5156
57+
sign:
58+
runs-on: ubuntu-latest
59+
needs: build
60+
steps:
61+
- uses: aws-actions/configure-aws-credentials@v4
62+
with:
63+
aws-access-key-id: ${{ secrets.BHE_AWS_ACCESS_KEY_ID }}
64+
aws-secret-access-key: ${{ secrets.BHE_AWS_SECRET_ACCESS_KEY }}
65+
aws-region: us-east-1
66+
67+
- uses: actions/download-artifact@v4
68+
with:
69+
pattern: azurehound-bin-*
70+
path: unsigned/
71+
72+
- name: Install osslsigncode
73+
run: |
74+
sudo apt-get update
75+
sudo apt-get install -y osslsigncode
76+
77+
- name: Sign Artifacts
78+
env:
79+
CODE_SIGN_CHAIN: ${{ secrets.CODE_SIGN_CHAIN }}
80+
CODE_SIGN_KEY: ${{ secrets.CODE_SIGN_KEY }}
81+
run: |
82+
set -ex
83+
84+
# osslsigncode demands certs and key as file
85+
CERT_FILE=$(mktemp)
86+
KEY_FILE=$(mktemp)
87+
printenv CODE_SIGN_CHAIN > $CERT_FILE
88+
printenv CODE_SIGN_KEY > $KEY_FILE
89+
90+
trap 'rm $CERT_FILE $KEY_FILE' EXIT
91+
92+
mkdir signed
93+
for artifact in unsigned/azurehound-bin-*/azurehound*; do
94+
tgt=$(echo "$artifact" | sed -E 's%.*-([^-]*)/azurehound(.*)%azurehound-\1\2%')
95+
osslsigncode sign \
96+
-certs $CERT_FILE \
97+
-key $KEY_FILE \
98+
-n AzureHound \
99+
-i https://www.specterops.io/ \
100+
-in "$artifact" \
101+
-out "signed/${tgt}"
102+
done
103+
104+
- name: Verify Signed Artifacts
105+
run: |
106+
for artifact in signed/azurehound*; do
107+
osslsigncode verify "$artifact"
108+
done
109+
110+
- name: Upload Artifacts to S3
111+
run: |
112+
aws s3 cp --recursive signed/ s3://${{ secrets.BHE_AWS_BUCKET }}/azurehound-signed/${AZUREHOUND_VERSION}/
113+
52114
containerize:
53115
runs-on: ubuntu-latest
54116
permissions:
55117
packages: write
56-
defaults:
57-
run:
58-
shell: bash
59118
steps:
60-
- uses: actions/checkout@v3
119+
- uses: actions/checkout@v4
61120

62121
- name: Log in to the Container registry
63122
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9

0 commit comments

Comments
 (0)