Bump docker/build-push-action from 4 to 5 (#48) #87
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: Build and publish Docker images | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- CONTEXT: applications/home-assistant | |
TAG: "2023.5.2" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.4" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.5" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.6" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "8.7" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "9.0" | |
- CONTEXT: operating_systems/almalinux | |
TAG: "9.1" | |
- CONTEXT: operating_systems/amazonlinux | |
TAG: "1" | |
- CONTEXT: operating_systems/amazonlinux | |
TAG: "2" | |
- CONTEXT: operating_systems/amazonlinux | |
TAG: "2022" | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: woody | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: sarge | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: etch | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: lenny | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: squeeze | |
- CONTEXT: operating_systems/debian | |
BASEIMAGE: debian/eol | |
TAG: wheezy | |
# - CONTEXT: operating_systems/debian | |
# BASEIMAGE: debian/eol | |
# TAG: jessie | |
# - CONTEXT: operating_systems/debian | |
# TAG: stretch | |
- CONTEXT: operating_systems/debian | |
TAG: buster | |
- CONTEXT: operating_systems/debian | |
TAG: bullseye | |
- CONTEXT: operating_systems/debian | |
TAG: bookworm | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.0" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.1" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.2" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.3" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.5" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.9" | |
- CONTEXT: operating_systems/euleros | |
TAG: "2.10" | |
- CONTEXT: operating_systems/mageia | |
TAG: "7" | |
- CONTEXT: operating_systems/mageia | |
TAG: "8" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "5" | |
UPDATED: false | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "6" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "7" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "8" | |
- CONTEXT: operating_systems/oraclelinux | |
TAG: "9" | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.6" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.7" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.8" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi7 | |
TAG: "7.9" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.0" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.1" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.2" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.3" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.4" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.5" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.6" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi8 | |
TAG: "8.7" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi9 | |
TAG: "9.0.0" | |
UPDATED: false | |
- CONTEXT: operating_systems/rhel | |
BASEIMAGE: registry.access.redhat.com/ubi9 | |
TAG: "9.1.0" | |
UPDATED: false | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.5" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.6" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.7" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "8.8" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "9.0" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "9.1" | |
- CONTEXT: operating_systems/rockylinux | |
TAG: "9.2" | |
- CONTEXT: operating_systems/slackware | |
TAG: "13.0" | |
- CONTEXT: operating_systems/slackware | |
TAG: "13.37" | |
- CONTEXT: operating_systems/slackware | |
TAG: "14.0" | |
- CONTEXT: operating_systems/slackware | |
TAG: "14.1" | |
- CONTEXT: operating_systems/slackware | |
TAG: "14.2" | |
- CONTEXT: operating_systems/slackware | |
TAG: "15.0" | |
- CONTEXT: operating_systems/slackware | |
TAG: current | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "10.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "12.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "12.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "13.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "13.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "14.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "14.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "15.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "15.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "16.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "16.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "17.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "17.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "18.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "18.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "19.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "19.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "20.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "20.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "21.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "21.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "22.04" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "22.10" | |
- CONTEXT: operating_systems/ubuntu | |
TAG: "23.04" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare environment variables | |
run: | | |
echo "IMAGE=ghcr.io/${{ github.repository }}/$(basename ${{ matrix.CONTEXT }}):${{ matrix.TAG }}" >> $GITHUB_ENV | |
echo "BUILD_ARGS<<EOF" >> $GITHUB_ENV | |
echo "TAG=${{ matrix.TAG }}" >> $GITHUB_ENV | |
if [[ -n "${{ matrix.BASEIMAGE }}" ]]; then | |
echo "BASEIMAGE=${{ matrix.BASEIMAGE }}" >> $GITHUB_ENV | |
fi | |
if [[ -n "${{ matrix.UPDATED }}" ]]; then | |
echo "UPDATED=${{ matrix.UPDATED }}" >> $GITHUB_ENV | |
fi | |
echo "EOF" >> $GITHUB_ENV | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.CONTEXT }} | |
load: true | |
tags: ${{ env.IMAGE }} | |
build-args: ${{ env.BUILD_ARGS }} | |
- name: Test Docker image | |
run: | | |
docker run --rm -d --name target -p 2222:22 ${{ env.IMAGE }} | |
sshpass -p demo ssh \ | |
-o "StrictHostKeyChecking no" \ | |
-o "KexAlgorithms $(ssh -Q kex | tr '\n' ',' | head -c -1)" \ | |
-o "Ciphers $(ssh -Q ciphers | tr '\n' ',' | head -c -1)" \ | |
-o "HostKeyAlgorithms $(ssh -Q key | tr '\n' ',' | head -c -1)" \ | |
demo@localhost -p 2222 echo "Hello from \$(whoami)@\$(cat /etc/hostname)" | |
docker stop target | |
- name: Publish Docker image | |
uses: docker/build-push-action@v5 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
context: ${{ matrix.CONTEXT }} | |
push: true | |
tags: ${{ env.IMAGE }} | |
build-args: ${{ env.BUILD_ARGS }} |