Skip to content

Commit

Permalink
🧱 Add build.yml workflow (#40)
Browse files Browse the repository at this point in the history
* Edit yaml lint

* Add image scanning

* Squash me
  • Loading branch information
Gary-H9 authored Nov 29, 2023
1 parent 1d65b01 commit d530416
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Build

on:
pull_request:
branches:
- main
push:
branches:
- main

permissions: {}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Build Image
id: build_image
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
push: false
load: true
tags: control-panel

- name: Scan Image
id: scan_image
uses: aquasecurity/trivy-action@2b6a709cf9c4025c5438138008beaddbb02086f0 # v0.14.0
with:
image-ref: control-panel
exit-code: 1
format: sarif
output: trivy-results.sarif
severity: CRITICAL
limit-severities-for-sarif: true

- name: Scan Image (On SARIF Scan Failure)
if: failure() && steps.scan_image.outcome == 'failure'
id: scan_image_on_failure
uses: aquasecurity/trivy-action@2b6a709cf9c4025c5438138008beaddbb02086f0 # v0.14.0
with:
image-ref: control-panel
exit-code: 1
format: table
severity: CRITICAL

- name: Upload SARIF
if: always()
id: upload_sarif
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.2.7
with:
sarif_file: trivy-results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Super-Linter

on: # yamllint disable-line rule:truthy
on:
pull_request:
branches:
- main
Expand Down
9 changes: 9 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: default

rules:
comments: disable
line-length:
level: warning
allow-non-breakable-inline-mappings: true
truthy: disable

0 comments on commit d530416

Please sign in to comment.