2023-12-07 11:02:08 +01:00
|
|
|
name: Build the Docker images and push them to the container registry
|
2022-11-15 22:49:39 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ "master" ]
|
|
|
|
|
|
|
|
jobs:
|
2023-12-06 15:15:19 +01:00
|
|
|
build:
|
2022-11-15 22:49:39 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2024-07-19 10:43:28 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [misp-core, misp-modules]
|
|
|
|
|
2023-12-06 15:15:19 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
2022-11-15 22:49:39 +01:00
|
|
|
steps:
|
2023-05-18 11:50:13 +02:00
|
|
|
- name: Checkout repository
|
2023-12-06 15:15:19 +01:00
|
|
|
uses: actions/checkout@v4
|
2022-11-15 22:49:39 +01:00
|
|
|
|
2023-12-06 15:15:19 +01:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-05-18 11:50:13 +02:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-12-06 15:15:19 +01:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-05-18 11:50:13 +02:00
|
|
|
|
2023-12-06 15:15:19 +01:00
|
|
|
- name: Initialize environment
|
2023-05-18 11:50:13 +02:00
|
|
|
env:
|
|
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
|
|
run: |
|
2023-09-15 13:23:35 +02:00
|
|
|
sed -e '/^[[:space:]]*$/d' -e '/[#@]/d' -e 's/\"//g' -e 's/\(^[^=]*\)=\(.*\)/\1="\2"/' template.env > env.hcl
|
2023-12-07 11:02:08 +01:00
|
|
|
echo "COMMIT_HASH=`echo '${{ github.sha }}' | cut -c 1-7`" >> "$GITHUB_ENV"
|
|
|
|
echo "NAMESPACE=ghcr.io/misp/misp-docker" >> "$GITHUB_ENV"
|
2023-12-06 15:15:19 +01:00
|
|
|
|
2023-12-07 11:02:08 +01:00
|
|
|
- name: Log in to the container registry
|
2023-12-06 15:15:19 +01:00
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/bake-action@v4
|
|
|
|
with:
|
|
|
|
push: true
|
2023-12-07 11:02:08 +01:00
|
|
|
provenance: false
|
2023-12-06 15:15:19 +01:00
|
|
|
files: docker-bake.hcl, env.hcl
|
2024-07-19 10:43:28 +02:00
|
|
|
targets: ${{ matrix.target }}
|