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

52 lines
1.6 KiB
YAML
Raw Normal View History

2021-05-01 17:36:30 +00:00
name: build
on:
2021-05-20 19:33:08 +00:00
workflow_dispatch:
2021-05-01 17:36:30 +00:00
push:
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 22:33:49 +00:00
runs-on: "ubuntu-20.04"
2021-05-01 17:36:30 +00:00
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build an image from Dockerfile
run: |
2021-05-06 18:40:22 +00:00
docker build \
-t ghcr.io/wonderfall/mastodon \
-t ghcr.io/wonderfall/mastodon:$(grep -oP '(?<=MASTODON_VERSION=).*' Dockerfile | head -c8) \
2021-05-08 22:30:39 +00:00
-t ghcr.io/wonderfall/mastodon:$(grep -oP '(?<=MASTODON_VERSION=).*' Dockerfile | head -c3) \
2021-05-06 18:40:22 +00:00
.
2021-05-01 17:36:30 +00:00
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
2021-05-01 18:11:11 +00:00
image-ref: 'ghcr.io/wonderfall/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: |
2021-05-01 18:21:57 +00:00
docker push ghcr.io/wonderfall/mastodon
2021-05-06 18:40:22 +00:00
docker push ghcr.io/wonderfall/mastodon:$(grep -oP '(?<=MASTODON_VERSION=).*' Dockerfile | head -c8)
2021-05-08 22:30:39 +00:00
docker push ghcr.io/wonderfall/mastodon:$(grep -oP '(?<=MASTODON_VERSION=).*' Dockerfile | head -c3)