github.com/khulnasoft-lab/tunnel-db@v0.0.0-20231117205118-74e1113bd007/.github/workflows/cron.yml (about)

     1  ---
     2  name: Tunnel DB
     3  on:
     4    schedule:
     5      - cron: '0 */6 * * *'
     6    workflow_dispatch:
     7  env:
     8    REPO_OWNER: ${{ github.repository_owner }} # used in 'make db-build'
     9    GH_USER: khulnasoft-bot
    10    VERSION: 2
    11  jobs:
    12    build:
    13      name: Build DB
    14      runs-on: ubuntu-latest
    15      steps:
    16        - name: Check out code into the Go module directory
    17          uses: actions/checkout@v4
    18  
    19        - name: Set up Go
    20          uses: actions/setup-go@v4
    21          with:
    22            go-version-file: go.mod
    23  
    24        - name: Install bbolt
    25          run: go install go.etcd.io/bbolt/cmd/bbolt@v1.3.5
    26  
    27  
    28        - name: Download vuln-list and advisories
    29          run: make db-fetch-langs db-fetch-vuln-list
    30  
    31        - name: Build the binary
    32          run: make build
    33  
    34        - name: Build database
    35          run: make db-build
    36  
    37        - name: Compact DB
    38          run: make db-compact
    39  
    40        - name: Compress assets
    41          run: make db-compress
    42  
    43        - name: Move DB
    44          run: mv assets/db.tar.gz .
    45  
    46        - name: Login to GitHub Packages Container registry
    47          uses: docker/login-action@v3
    48          with:
    49            registry: ghcr.io
    50            username: ${{ env.GH_USER }}
    51            password: ${{ secrets.GITHUB_TOKEN }}
    52  
    53        - name: Install oras
    54          run: |
    55            # upgrade to ORAS 1.0.0
    56            curl -LO https://github.com/oras-project/oras/releases/download/v1.0.0/oras_1.0.0_linux_amd64.tar.gz
    57            tar -xvf ./oras_1.0.0_linux_amd64.tar.gz
    58  
    59        - name: Upload assets to GHCR
    60          run: |
    61            ./oras version
    62            tags=(latest ${{ env.VERSION }})
    63            for tag in ${tags[@]}; do
    64              ./oras push --artifact-type application/vnd.khulnasoft.vul.config.v1+json \
    65                ghcr.io/${{ github.repository }}:${tag} \
    66                db.tar.gz:application/vnd.khulnasoft.tunnel.db.layer.v1.tar+gzip
    67            done