Trivy Java DB #531
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Trivy Java DB | |
on: | |
schedule: | |
- cron: "0 0 * * *" # update indexes every day in 00:00 | |
workflow_dispatch: | |
env: | |
GH_USER: aqua-bot | |
DB_VERSION: 1 | |
permissions: | |
packages: write # for GHCR | |
contents: read | |
jobs: | |
build: | |
name: Build DB | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build the binary | |
run: make build | |
- name: Crawl indexes | |
run: make db-crawl | |
- name: Build database | |
run: make db-build | |
- name: Compress database | |
run: make db-compress | |
- name: Move DB | |
run: mv cache/db/javadb.tar.gz . | |
- name: Login to GitHub Packages Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ env.GH_USER }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload assets to GHCR | |
run: | | |
lowercase_repo=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
oras version | |
oras push --artifact-type application/vnd.aquasec.trivy.config.v1+json \ | |
ghcr.io/${lowercase_repo}:${DB_VERSION} \ | |
javadb.tar.gz:application/vnd.aquasec.trivy.javadb.layer.v1.tar+gzip |