Pipeline #157
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: Pipeline | |
on: | |
pull_request: | |
branches: | |
- '*' | |
- '**' | |
push: | |
branches: | |
- '*' | |
- '**' | |
schedule: | |
- cron: '15 0 * * TUE' # Runs at 00:15 every Tuesday. | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Latest Dev Packages | |
if: github.event_name == 'schedule' | |
run: | | |
cut -d= requirements-dev.txt -f1 > /tmp/requirements-dev.txt | |
cp /tmp/requirements-dev.txt requirements-dev.txt | |
- name: Requirements | |
run: | | |
pip install -qr requirements.txt -r requirements-dev.txt | |
pip freeze | |
pip check | |
- name: Run Make | |
run: make github | |
Trivy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: docker compose build router | |
- name: Scan Image | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: "router:latest" | |
trivy-config: trivy.yaml | |
Publish: | |
runs-on: ubuntu-latest | |
needs: [CI, Trivy] # Ensure this job only runs after CI and Trivy are successful | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Docker Tag | |
id: get-tag | |
run: | | |
echo "DOCKER_TAG=$(make tag)" >> $GITHUB_ENV | |
- name: Build Docker Image | |
run: docker build -t ${{ env.REGISTRY }}/cbdq-io/a-fake-rotor-true:${{ env.DOCKER_TAG }} . | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker Image | |
run: docker push ${{ env.REGISTRY }}/cbdq-io/a-fake-rotor-true:${{ env.DOCKER_TAG }} |