-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (70 loc) · 1.88 KB
/
bats.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
---
name: Build bats docker image
run-name: ${{ github.actor }} is building bats
on:
push:
branches: ["main"]
paths:
- "bats/**"
pull_request:
branches: ["main"]
paths:
- "bats/**"
env:
REGISTRY: ghcr.io
IMAGE_TAG: ${{ github.repository }}/bats:v1.10.0-curl
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: bats
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_TAG }}
scan:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
needs: build
steps:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_TAG }}
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Dockerfile linting
uses: hadolint/[email protected]
with:
dockerfile: bats/Dockerfile
ignore: DL3018