update workflow
use github container registry
This commit is contained in:
parent
7db1c00a19
commit
a713c9622a
1 changed files with 15 additions and 4 deletions
|
@ -7,11 +7,12 @@ on:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '37 20 * * 3'
|
# Build the image regularly (each Friday)
|
||||||
|
- cron: '13 22 * * 5'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build, scan & push
|
||||||
runs-on: "ubuntu-18.04"
|
runs-on: "ubuntu-18.04"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
@ -19,18 +20,28 @@ jobs:
|
||||||
|
|
||||||
- name: Build an image from Dockerfile
|
- name: Build an image from Dockerfile
|
||||||
run: |
|
run: |
|
||||||
docker build -t mastodon .
|
docker build -t ghcr.io/$GITHUB_ACTOR/mastodon .
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
image-ref: 'mastodon'
|
image-ref: 'ghcr.io/$GITHUB_ACTOR/mastodon'
|
||||||
format: 'template'
|
format: 'template'
|
||||||
template: '@/contrib/sarif.tpl'
|
template: '@/contrib/sarif.tpl'
|
||||||
output: 'trivy-results.sarif'
|
output: 'trivy-results.sarif'
|
||||||
severity: 'CRITICAL,HIGH'
|
severity: 'CRITICAL,HIGH'
|
||||||
|
vuln-type: "os"
|
||||||
|
|
||||||
- name: Upload Trivy scan results to GitHub Security tab
|
- name: Upload Trivy scan results to GitHub Security tab
|
||||||
uses: github/codeql-action/upload-sarif@v1
|
uses: github/codeql-action/upload-sarif@v1
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
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
|
Loading…
Reference in a new issue