Build and Upload vdb5 #1041
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: Build and Upload vdb | |
on: | |
schedule: | |
- cron: "0 */8 * * *" | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: appthreat/vdb | |
jobs: | |
builder: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: AppThreat/vulnerability-db | |
path: vulnerability-db | |
ref: 'v5.5.1' | |
- uses: actions/checkout@v3 | |
with: | |
repository: AppThreat/vuln-list | |
path: vuln-list | |
fetch-depth: '1' | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine build | |
cd vulnerability-db && pip install ".[dev]" | |
- name: Build and upload db | |
run: | | |
mkdir vdb_data vdb_cache | |
zip -q -r vuln-list.zip ./vuln-list/ | |
mv vuln-list.zip vdb_cache/ | |
rm -rf ./vuln-list/ | |
python vulnerability-db/vdb/cli.py --cache-os | |
ls -lh vdb_data | |
ls -lh vdb_cache | |
cd vdb_data | |
echo $GITHUB_TOKEN | oras login ghcr.io -u $GITHUB_USERNAME --password-stdin | |
oras push ghcr.io/$IMAGE_NAME:v5 \ | |
--config ../config.json:application/vnd.oras.config.v1+json \ | |
--annotation-file ../annotations.json \ | |
./data.vdb5:application/vnd.appthreat.vdb.layer.v1+tar \ | |
./data.index.vdb5:application/vnd.appthreat.vdb.layer.v1+tar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PYTHONPATH: vulnerability-db | |
VDB_HOME: vdb_data | |
VDB_CACHE: vdb_cache | |
GITHUB_PAGE_COUNT: 5 | |
NVD_START_YEAR: 2018 | |
GITHUB_USERNAME: ${{ github.actor }} | |
# - name: Release public ecr | |
# run: | | |
# cd vdb_data | |
# aws ecr-public get-login-password --region us-east-1 | oras login -u AWS --password-stdin public.ecr.aws | |
# oras push public.ecr.aws/$IMAGE_NAME:v5 \ | |
# --artifact-type application/vnd.oras.config.v1+json \ | |
# ./data.vdb5:application/vnd.appthreat.vdb.layer.v1+tar \ | |
# ./data.index.vdb5:application/vnd.appthreat.vdb.layer.v1+tar | |
# env: | |
# REGISTRY: public.ecr.aws | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} |