ci: Update Security analysis workflow

This commit is contained in:
Carlos Álvaro
2021-03-13 20:59:01 +01:00
parent 828092ad75
commit ccf7a04053
3 changed files with 40 additions and 74 deletions

View File

@@ -1,6 +1,10 @@
name: Security analysis
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * 1'
@@ -8,9 +12,45 @@ jobs:
security-analysis:
name: Trivy scan
runs-on: ubuntu-latest
env:
CACHE_PATH: /tmp/.buildx-cache
steps:
- name: Checkout repository
if: github.event_name != 'schedule'
uses: actions/checkout@v2
- name: Set up QEMU
if: github.event_name != 'schedule'
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
if: github.event_name != 'schedule'
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
if: github.event_name != 'schedule'
uses: actions/cache@v2.1.4
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build docker-salt-master image
if: github.event_name != 'schedule'
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
cache-from: |
type=local,src=${{ env.CACHE_PATH }}
ghcr.io/cdalvaro/docker-salt-master:${{ github.sha }}
cache-to: type=local,dest=${{ env.CACHE_PATH }}
push: false
- name: Download and tag latest image
if: github.event_name == 'schedule'
run: |
docker pull ghcr.io/cdalvaro/docker-salt-master:latest
docker tag ghcr.io/cdalvaro/docker-salt-master:latest ghcr.io/cdalvaro/docker-salt-master:${{ github.sha }}