Skip to content

Pre-release for Wazuh agent v4.7.2-1 (#97) #47

Pre-release for Wazuh agent v4.7.2-1 (#97)

Pre-release for Wazuh agent v4.7.2-1 (#97) #47

name: Build and push docker images for git tag
# Controls when the workflow will run
on:
push:
tags:
- 'v*.*.*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./Dockerfile
image: kennyopennix/wazuh-agent
- dockerfile: ./images/Dockerfile.amazonlinux
image: kennyopennix/wazuh-agent-amazonlinux
- dockerfile: ./images/Dockerfile.ubuntu
image: kennyopennix/wazuh-agent-ubuntu
- dockerfile: ./Dockerfile
image: opennix/wazuh-agent
- dockerfile: ./images/Dockerfile.amazonlinux
image: opennix/wazuh-agent-amazonlinux
- dockerfile: ./images/Dockerfile.ubuntu
image: opennix/wazuh-agent-ubuntu
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set Agent version
shell: bash
run: echo "AGENT_VERSION=$(echo ${GITHUB_REF##*/} | sed 's/v//g')" >> $GITHUB_ENV
- name: Set Docker tag
shell: bash
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/} | sed 's/v//g'|sed 's/-1//g')" >> $GITHUB_ENV
- name: Docker tag and agent version
run: |
echo "All envs ${{ env }}"
echo "New docker image tag ${{ env.TAG_NAME }}"
echo "Wazuh agent version ${{ env.AGENT_VERSION }}"
- name: Build and push
uses: docker/build-push-action@v5
continue-on-error: true
with:
context: .
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ matrix.image }}:${{ env.TAG_NAME }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
AGENT_VERSION=${{ env.AGENT_VERSION }}