1
0
mirror of https://github.com/tommytran732/Synapse-Docker synced 2024-11-09 18:31:32 -05:00
Synapse-Docker/.github/workflows/build.yml

52 lines
1.6 KiB
YAML
Raw Normal View History

2021-06-02 13:11:41 -04:00
name: build
on:
workflow_dispatch:
push:
branches: [ main ]
schedule:
# Build the image regularly (each Friday)
- cron: '13 21 * * 5'
jobs:
build:
name: Build, scan & push
runs-on: "ubuntu-20.04"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build an image from Dockerfile
run: |
docker build \
-t ghcr.io/wonderfall/synapse \
-t ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c6) \
-t ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c4) \
.
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/wonderfall/synapse'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
vuln-type: "os"
- name: Upload Trivy scan results to GitHub Security tab
2022-09-11 07:40:52 -04:00
uses: github/codeql-action/upload-sarif@v2
2021-06-02 13:11:41 -04:00
with:
sarif_file: 'trivy-results.sarif'
- name: Docker login
run: >-
2022-09-06 14:09:48 -04:00
echo "${{ secrets.GITHUB_TOKEN }}"
2021-06-02 13:11:41 -04:00
| docker login -u "${{ github.actor }}" --password-stdin ghcr.io
- name: Push image to GitHub
run: |
docker push ghcr.io/wonderfall/synapse
docker push ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c6)
2022-09-06 14:09:48 -04:00
docker push ghcr.io/wonderfall/synapse:$(grep -oP '(?<=SYNAPSE_VERSION=).*' Dockerfile | head -c4)