forked from geerlingguy/ansible-role-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (132 loc) · 4.13 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
143
144
145
146
name: CI
on:
workflow_dispatch:
inputs:
runKics:
description: Run KICS scan
type: boolean
default: true
runLint:
description: Run Ansible Lint
type: boolean
default: true
runMolecule:
description: Run Ansible Molecule
type: boolean
default: true
publishRelease:
description: Publish Release
type: boolean
default: false
required: false
push:
paths-ignore: ["**.md", "LICENSE", ".github/dependabot.yml"]
branches: ["master", "main"]
pull_request:
branches: ["master", "main"]
env:
KICS_SCAN_PATH: "./"
jobs:
scan:
name: Checkmarx KICS
runs-on: ubuntu-latest
timeout-minutes: 5
if: |
inputs.runKics == true ||
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'schedule'
permissions:
contents: read
issues: write
pull-requests: write
security-events: write
actions: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run KICS scan
uses: checkmarx/kics-github-action@d1b692d84c536f4e8696954ce7aab6818f95f5bc # v2.0.0
with:
path: ${{ env.KICS_SCAN_PATH }}
fail_on: high
output_formats: "json,sarif"
exclude_paths: ".github/workflows/scorecard.yml"
continue-on-error: true
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
with:
sarif_file: results.sarif
lint:
name: Ansible Lint
runs-on: ubuntu-latest
timeout-minutes: 5
if: |
inputs.runLint == true ||
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'schedule'
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run Ansible Lint
uses: unleftie/ansible-lint-action@f6c9ea06aebdd94a4a7e0414d630fdb6832b1083 # v1.1.0
molecule:
name: Ansible Molecule
runs-on: ubuntu-latest
timeout-minutes: 15
if: |
inputs.runMolecule == true ||
github.event_name == 'push' ||
github.event_name == 'pull_request' ||
github.event_name == 'schedule'
strategy:
matrix:
distro:
- debian12
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
disable-sudo: true
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run Ansible Molecule
uses: unleftie/ansible-molecule-action@e8cecf7f6dfab2293dd28df032318e6a698c60a3 # v1.7.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
role_name: ${{ github.event.repository.name }}
distro: ${{ matrix.distro }}
release:
name: Publish Release
runs-on: ubuntu-latest
if: inputs.publishRelease == true || github.event_name == 'push'
needs: [scan, lint, molecule]
permissions:
packages: write
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
persist-credentials: false
- name: Semantic Release
uses: cycjimmy/semantic-release-action@cb425203a562475bca039ba4dbf90c7f9ac790f4 #v4.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
extra_plugins: conventional-changelog-conventionalcommits@6.1.0