-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (93 loc) · 2.75 KB
/
ci.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
name: Dissect CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
mkdir -p build
cp -r dissect_addon build/dissect_addon
- uses: actions/upload-artifact@v4
with:
name: build
path: build/*
retention-days: 1
build-lint:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build
path: build/
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- run: |
pip install splunk-packaging-toolkit
slim validate build/dissect_addon
release:
if: ${{ github.ref_name == 'main' || github.ref_type == 'tag' }}
needs: build-lint
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build
path: build/
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- run: echo "APP_VERSION=\"$(git describe --tags 2>/dev/null || echo "0.0.0")\"" >> $GITHUB_ENV
- run: |
sed -i -E "s/version = (.*)/version = $APP_VERSION/g" build/dissect_addon/default/app.conf
pip install splunk-packaging-toolkit
mkdir -p dist
slim package -o dist/ build/dissect_addon
- uses: actions/upload-artifact@v4
with:
name: release
path: dist/dissect_addon-${{ env.APP_VERSION }}.tar.gz
retention-days: 1
release-lint:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: release
path: dist/
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- run: |
pip install splunk-appinspect
splunk-appinspect inspect --included-tags private_app --included-tags appapproval --included-tags splunk-appinspect --data-format junitxml --output-file appinspect_report.xml dist/dissect_addon-$APP_VERSION.tar.gz
! grep --quiet --extended-regexp "<(error|failure)" appinspect_report.xml
- uses: actions/upload-artifact@v4
with:
name: appinspect_report
path: appinspect_report.xml
retention-days: 1
publish-to-gh:
if: github.ref_type == 'tag'
needs: release-lint
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: release
path: dist/
- run: gh release create --generate-notes $APP_VERSION dist/dissect_addon-$APP_VERSION.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}