Skip to content

Build and publish docker images #10

Build and publish docker images

Build and publish docker images #10

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
- cron: "30 12 * * *" # runs everyday at 12h30
env:
PUBLISH_IMAGE: ${{ if (github.ref == 'main' || github.ref_type == 'branch') && 'TRUE' || 'FALSE'}}

Check failure on line 12 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yaml (Line: 12, Col: 18): Unrecognized function: 'if'. Located at position 1 within expression: if (github.ref == 'main' || github.ref_type == 'branch') && 'TRUE' || 'FALSE' .github/workflows/ci.yaml (Line: 13, Col: 14): Unrecognized named-value: 'if'. Located at position 1 within expression: if github.ref == 'main' && 'latest' || github.ref
IMAGE_TAG: ${{ if github.ref == 'main' && 'latest' || github.ref }}
IMAGE_NAME: ghcr.io/${{ github.repository }}/arpav-ppcv-backend:${{ IMAGE_TAG }}
jobs:
run-dagger-ci:
runs-on: ubuntu-22.04
steps:
- name: grab code
uses: actions/checkout@v4
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
cache-dependency-path: docker/backend/project_requirements.txt
- name: install dagger for python
uses: insightsengineering/pip-action@v2
with:
packages: dagger-io==0.9.8
- name: login to container registry
if: ${{ env.PUBLISH_IMAGE == 'TRUE' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: run ci
uses: dagger/dagger-for-github@v5
with:
verb: run
args: >-
python tests/ci/main.py
--with-tests
${{ if (env.PUBLISH_IMAGE == 'TRUE' && format('--image-registry {0}', env.IMAGE_NAME) || ''}}
version: 0.9.9
# Periodically scan built image for vulnerabilities
- name: run security scanning
if: ${{ github.event.schedule }}
uses: dagger/dagger-for-github@v5
with:
verb: run
args: python tests/ci/main.py --with-security-scan
version: 0.9.9