Skip to content

.github/workflows/message-queue-ci.yaml: #28

.github/workflows/message-queue-ci.yaml:

.github/workflows/message-queue-ci.yaml: #28

name: message-queue-ci
on:
push:
paths:
- "message-queue/*"
- ".github/workflows/message-queue-ci.yaml"
concurrency:
# Automatically cancel workflows if newer workflow started for the same
# branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY_URL: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASS: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-base-debian:
runs-on: ubuntu-latest
env:
# IMAGE: image name when referring to it through podman-compose
IMAGE: base-debian
PROJECT: code-golf_message-queue
IMAGE_FULL: code-golf_message-queue_base-debian
# Build step
# run: echo "IMAGE_FULL=$PROJECT_$IMAGE" >> "$GITHUB_ENV"
# doesn't seem to be working.
steps:
- uses: actions/checkout@v4
- name: Show changed files
run: >
cd message-queue && git diff --names-only master..${{ github.ref }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: message-queue/container/${{ env.IMAGE }}
- name: Install podman-compose
if: steps.changed-files.outputs.any_changed == 'true'
run: pip3 install podman-compose
# Ubuntu also uses too old (1.0.6) version
# run: sudo apt-get install -y podman-compose
- name: Print podman-compose version
run: podman-compose version
- name: Log in to the Github Container registry
if: steps.changed-files.outputs.any_changed == 'true'
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASS }}
- name: Build image
if: steps.changed-files.outputs.any_changed == 'true'
run: >
cd message-queue &&
podman-compose
-p ${{ env.PROJECT }}
--podman-build-args "-t ${{ env.IMAGE_FULL }}:${{ github.sha }}"
build "${{ env.IMAGE }}"
- name: Print podman images
run: podman image ls -a
- name: Push image
if: steps.changed-files.outputs.any_changed == 'true'
id: push
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.PROJECT }}_${{ env.IMAGE }}
tags: ${{ github.sha }}
registry: ${{ env.REGISTRY_URL }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASS }}
- name: Print image url
if: steps.changed-files.outputs.any_changed == 'true'
run: >
printf "Image pushed to %s\n"
"${{ steps.push.outputs.registry-paths }}"