Skip to content

Release

Release #6

Workflow file for this run

---
name: Release
'on':
pull_request:
push:
branches:
- main
schedule:
- cron: "0 7 * * 0"
env:
IMAGE_NAME: yaf
jobs:
# Test the image builds and works correctly.
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install test dependencies.
run: pip3 install pytest-testinfra
- name: Build image.
run: docker build -t cmusei/${{ env.IMAGE_NAME }} .
- name: Run the built image.
run: docker run --name=${{ env.IMAGE_NAME }} --entrypoint=/bin/bash -td cmusei/${{ env.IMAGE_NAME }}
- name: Test the built image.
run: py.test --hosts='docker://${{ env.IMAGE_NAME }}'
# If on main branch, build and release image.
release2:
name: Release2
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image.
uses: docker/build-push-action@v6
with:
context: ./
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
cmusei/${{ env.IMAGE_NAME }}:latest
cmusei/${{ env.IMAGE_NAME }}:2
cmusei/${{ env.IMAGE_NAME }}:2.16.1
ghcr.io/cmu-sei/${{ env.IMAGE_NAME }}:latest
ghcr.io/cmu-sei/${{ env.IMAGE_NAME }}:2
ghcr.io/cmu-sei/${{ env.IMAGE_NAME }}:2.16.1
release3:
name: Release3
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image.
uses: docker/build-push-action@v6
with:
context: ./
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
FIXBUF_VERSION=3
YAF_VERSION=3.0.0.alpha4
tags: |
cmusei/${{ env.IMAGE_NAME }}:3
ghcr.io/cmu-sei/${{ env.IMAGE_NAME }}:3