docker-mastodon/.github/workflows/build.yml

48 lines
1.3 KiB
YAML
Raw Normal View History

2021-05-01 17:36:30 +00:00
name: build
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
# Build the image regularly (each Friday)
- cron: '13 22 * * 5'
2021-05-01 17:36:30 +00:00
jobs:
build:
name: Build, scan & push
2021-05-01 17:36:30 +00:00
runs-on: "ubuntu-18.04"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build an image from Dockerfile
run: |
2021-05-01 18:08:12 +00:00
docker build ghcr.io/$GITHUB_ACTOR/mastodon .
2021-05-01 17:36:30 +00:00
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/$GITHUB_ACTOR/mastodon'
2021-05-01 17:36:30 +00:00
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
vuln-type: "os"
2021-05-01 17:36:30 +00:00
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: 'trivy-results.sarif'
- name: Docker login
run: >-
echo "${{ secrets.GHCR_TOKEN }}"
| docker login -u "${{ github.actor }}" --password-stdin ghcr.io
- name: Push image to GitHub
run: |
docker push ghcr.io/$GITHUB_ACTOR/mastodon