This repository has been archived by the owner on Dec 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
142 lines (133 loc) · 5.18 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI/CD
on:
push:
branches:
- master
- develop
- beta
- alpha
- '[0-9]+.x'
- '[0-9]+.[0-9]+.x'
jobs:
appinspect-addon:
name: AppInspect (Add-on)
runs-on: ubuntu-20.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build Add-on
id: build-addon
run: scripts/build.sh -a addon
- name: Save Add-on Build Artifact
uses: actions/upload-artifact@v1
if: '! cancelled()'
with:
name: Splunk_TA_paloalto-${{ github.run_id }}
path: ${{ steps.build-addon.outputs.path }}
- name: AppInspect
run: scripts/appinspect.sh -a addon -r
env:
SPLUNK_USER: ${{ secrets.SPLUNK_USER }}
SPLUNK_PASS: ${{ secrets.SPLUNK_PASS }}
- name: Save report
uses: actions/upload-artifact@v1
if: '! cancelled()'
with:
name: Report-Splunk_TA_paloalto-${{ github.run_id }}.html
path: _build/Splunk_TA_paloalto-${{ github.run_id }}.html
appinspect-app:
name: AppInspect (App)
runs-on: ubuntu-20.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build App
id: build-app
run: scripts/build.sh -a app
- name: Save App Build Artifact
uses: actions/upload-artifact@v1
if: '! cancelled()'
with:
name: SplunkforPaloAltoNetworks-${{ github.run_id }}
path: ${{ steps.build-app.outputs.path }}
- name: AppInspect
run: scripts/appinspect.sh -a app -r
env:
SPLUNK_USER: ${{ secrets.SPLUNK_USER }}
SPLUNK_PASS: ${{ secrets.SPLUNK_PASS }}
- name: Save report
uses: actions/upload-artifact@v1
if: '! cancelled()'
with:
name: Report-SplunkforPaloAltoNetworks-${{ github.run_id }}.html
path: _build/SplunkforPaloAltoNetworks-${{ github.run_id }}.html
release:
name: Release
if: github.ref != 'refs/heads/develop'
needs: [appinspect-addon, appinspect-app]
runs-on: ubuntu-20.04
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
new_release_channel: ${{ steps.semantic.outputs.new_release_channel }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Create release and publish
id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19.0.5
extra_plugins: |
conventional-changelog-conventionalcommits@^5.0.0
@semantic-release/exec@^6.0.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPLUNK_USER: ${{ secrets.SPLUNK_USER }}
SPLUNK_PASS: ${{ secrets.SPLUNK_PASS }}
docker-build:
name: Docker Build
needs: [release]
# When to run, per https://github.com/actions/runner/issues/491#issuecomment-850884422
if: always() && (needs.release.result == 'success' || needs.release.result == 'skipped')
runs-on: ubuntu-20.04
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/splunk-demo
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Determine docker tags and labels
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# On a release, tag with 'latest' and semantic versions (eg v3.2.1, v3.2, and v3)
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=semver,pattern=v{{version}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
type=semver,pattern=v{{major}}.{{minor}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
type=semver,pattern=v{{major}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
type=semver,pattern=v{{version}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }}
- name: Set the version in app.conf
if: needs.release.result == 'success' && needs.release.outputs.new_release_published == 'true'
run: scripts/set-version.sh ${{ needs.release.outputs.new_release_version }} ${{ needs.release.outputs.new_release_channel }}
- name: Login to Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: demo/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}