Skip to content

Build Portage CD Action Images #20

Build Portage CD Action Images

Build Portage CD Action Images #20

Workflow file for this run

name: Build portage images for use it GitHub actions.
run-name: "Build Portage CD Action Images"
permissions:
contents: read
packages: write
checks: write
on:
workflow_dispatch:
push:
pull_request:
branches:
- main
jobs:
image_delivery:
runs-on: ubuntu-latest
name: Build Image with Docker Action
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Set outputs
id: vars
run: |
image_repo=ghcr.io/easy-up/portage-action
image_tag=${GITHUB_SHA::8}
# If on a git tag like vx.x.x, change the image tag to reflect
echo "GITHUB_REF: $GITHUB_REF"
if [[ $GITHUB_REF == refs/tags/v* ]]; then
image_tag=${GITHUB_REF/refs\/tags\//}
elif [[ $GITHUB_REF == refs/heads/debug* ]]; then
image_tag=${GITHUB_REF/refs\/heads\//}
fi
# Image Names
echo "image_name=$image_repo:$image_tag" >> $GITHUB_OUTPUT
echo "podman_image_name=$image_repo:podman-$image_tag" >> $GITHUB_OUTPUT
# Build Variables
echo "version=$(cat PORTAGE_VERSION)" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./image-build-scan-publish/docker/
push: true
tags: ${{ steps.vars.outputs.image_name }}
build-args: "VERSION=${{ steps.vars.outputs.version }}"
- name: Build and push podman target
uses: docker/build-push-action@v5
with:
context: ./image-build-scan-publish/podman/
push: true
tags: ${{ steps.vars.outputs.podman_image_name }}
build-args: "VERSION=${{ steps.vars.outputs.version }}"
- name: job summary
shell: bash
run: |
echo "## Docker Action Image Build and Push Summary" >> $GITHUB_STEP_SUMMARY
echo ":white_check_mark: Image (Docker CLI): ${{ steps.vars.outputs.image_name }}" >> $GITHUB_STEP_SUMMARY
echo ":white_check_mark: Image (Podman CLI): ${{ steps.vars.outputs.podman_image_name }}" >> $GITHUB_STEP_SUMMARY