-
Notifications
You must be signed in to change notification settings - Fork 18
57 lines (55 loc) · 1.61 KB
/
build-agent-splunk.yml
File metadata and controls
57 lines (55 loc) · 1.61 KB
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
name: Build agent-splunk
on:
push:
branches: [main]
paths:
- 'tools/agents/agent-splunk/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Build
working-directory: tools/agents/agent-splunk
run: CGO_ENABLED=0 go build -o agent-splunk .
- name: Upload binary artifact
uses: actions/upload-artifact@v7
with:
name: agent-splunk
path: tools/agents/agent-splunk/agent-splunk
release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Determine version
id: version
run: |
VERSION="${{ github.event.inputs.version }}"
if [ -z "$VERSION" ]; then
VERSION="agent-splunk-$(date +'%Y%m%d')-${GITHUB_SHA::7}"
fi
echo "tag=$VERSION" >> "$GITHUB_OUTPUT"
- name: Download binary artifact
uses: actions/download-artifact@v8
with:
name: agent-splunk
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
if gh release view "$TAG" > /dev/null 2>&1; then
gh release upload "$TAG" agent-splunk --clobber
else
gh release create "$TAG" \
--title "agent-splunk $TAG" \
agent-splunk
fi