Skip to content

Update PyPI publishing #34

Update PyPI publishing

Update PyPI publishing #34

Workflow file for this run

name: Container Build
on:
pull_request:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io/doganulus
IMAGE_NAME: reelay
PODMAN_ARCH: amd64
PLATFORM: linux-amd64
REELAY_VERSION: latest
REELAY_LATEST_VERSION: latest
permissions:
contents: read
packages: write
jobs:
buildah-build:
name: Build container images
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}
cancel-in-progress: true
steps:
- name: Install container tools
run: sudo apt-get install podman buildah jq
- name: Checkout repository
uses: actions/checkout@v6
- name: Prepare environment variables
run: |
echo "PODMAN_ARCH=$(podman info --format='{{.Host.Arch}}')" >> $GITHUB_ENV
echo "PLATFORM=$(podman info --format='{{.Version.OsArch}}' | sed 's/\//-/g')" >> $GITHUB_ENV
echo "REELAY_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Log in to the GitHub Container registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build builder container image
id: build-builder
uses: redhat-actions/buildah-build@v2
with:
context: ./containers
image: reelay
tags: |
${{ env.REELAY_VERSION }}-builder
${{ env.REELAY_VERSION }}-builder-${{ env.PODMAN_ARCH }}
layers: true
oci: true
build-args: |
REELAY_VERSION=${{ env.REELAY_VERSION }}
REELAY_IMAGE_REGISTRY_REMOTE=${{ env.REGISTRY }}
extra-args: |
--target reelay-builder
containerfiles: |
./containers/devel/Dockerfile
- name: Build devel container image
id: build-devel
uses: redhat-actions/buildah-build@v2
with:
context: ./containers
image: reelay
tags: ${{ env.REELAY_VERSION }}-devel ${{ env.REELAY_VERSION }}-devel-${{ env.PODMAN_ARCH }}
layers: true
oci: true
build-args: |
REELAY_VERSION=${{ env.REELAY_VERSION }}
REELAY_IMAGE_REGISTRY_REMOTE=${{ env.REGISTRY }}
extra-args: |
--target reelay-devel
containerfiles: |
./containers/devel/Dockerfile
- name: Build ryjson container image
id: build-ryjson
uses: redhat-actions/buildah-build@v2
with:
context: ./containers
image: ryjson
tags: ${{ env.REELAY_VERSION }} ${{ env.REELAY_VERSION }}-${{ env.PODMAN_ARCH }}
layers: true
oci: true
build-args: |
REELAY_VERSION=${{ env.REELAY_VERSION }}
REELAY_IMAGE_REGISTRY_REMOTE=${{ env.REGISTRY }}
extra-args: |
--target ryjson
containerfiles: |
./containers/ryjson/Dockerfile
- name: Push to GitHub Container Repository
# if: github.ref == 'refs/heads/main'
id: push-builder-ghcr
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
image: ${{ steps.build-builder.outputs.image }}
tags: ${{ env.REELAY_VERSION }}-builder-${{ env.PODMAN_ARCH }}
digestfile: ${{ runner.temp }}/digest-reelay-builder-${{ env.REELAY_VERSION }}-${{ env.PLATFORM }}
- name: Push to GitHub Container Repository
# if: github.ref == 'refs/heads/main'
id: push-devel-ghcr
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
image: ${{ steps.build-devel.outputs.image }}
tags: ${{ env.REELAY_VERSION }}-devel-${{ env.PODMAN_ARCH }}
digestfile: ${{ runner.temp }}/digest-reelay-devel-${{ env.REELAY_VERSION }}-${{ env.PLATFORM }}
- name: Push to GitHub Container Repository
# if: github.ref == 'refs/heads/main'
id: push-runtime-ghcr
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.REGISTRY }}
image: ${{ steps.build-ryjson.outputs.image }}
tags: ${{ env.REELAY_VERSION }}-${{ env.PODMAN_ARCH }}
digestfile: ${{ runner.temp }}/digest-ryjson-${{ env.REELAY_VERSION }}-${{ env.PLATFORM }}
- name: Upload digests
# if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: digest-reelay-${{ env.REELAY_VERSION }}-${{ env.PLATFORM }}
path: ${{ runner.temp }}/digest-*
if-no-files-found: error
retention-days: 1
compression-level: 0 # no compression
buildah-merge:
name: Merge container images
runs-on: ubuntu-24.04
needs: buildah-build
# if: github.ref == 'refs/heads/main' && always()
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digest-*
merge-multiple: true
- name: Log in to the GitHub Container registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare environment variables
run: |
echo "REELAY_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
tag=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | jq -r '.tag_name')
ref_info=$(curl -s "https://api.github.com/repos/$repo/git/ref/tags/$tag")
obj_type=$(echo "$ref_info" | jq -r '.object.type')
tag_sha=$(echo "$ref_info" | jq -r '.object.sha')
if [ "$obj_type" = "commit" ]; then
commit_sha="$tag_sha"
else
commit_sha=$(curl -s "https://api.github.com/repos/$repo/git/tags/$tag_sha" | jq -r '.object.sha')
fi
echo "REELAY_LATEST_VERSION=$commit_sha" >> "$GITHUB_ENV"
- name: Create and push manifest list for reelay-builder
run: |
MANIFEST=reelay-builder
FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
buildah manifest create $MANIFEST
for digest in ${{ runner.temp }}/digests/digest-reelay-builder-*; do
echo "Adding $(cat $digest)"
buildah manifest add $MANIFEST $FULL_IMAGE_NAME@$(cat $digest)
done
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:${{ env.REELAY_VERSION }}-builder
if [ "${{ env.REELAY_VERSION }}" == "${{ env.REELAY_LATEST_VERSION }}" ]; then
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest-builder
fi
- name: Create and push manifest list for reelay-devel
run: |
MANIFEST=reelay-devel
FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
buildah manifest create $MANIFEST
for digest in ${{ runner.temp }}/digests/digest-reelay-devel-*; do
echo "Adding $(cat $digest)"
buildah manifest add $MANIFEST $FULL_IMAGE_NAME@$(cat $digest)
done
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:${{ env.REELAY_VERSION }}-devel
if [ "${{ env.REELAY_VERSION }}" == "${{ env.REELAY_LATEST_VERSION }}" ]; then
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest-devel
fi
- name: Create and push manifest list for ryjson
run: |
MANIFEST=ryjson
FULL_IMAGE_NAME=${{ env.REGISTRY }}/ryjson
buildah manifest create $MANIFEST
for digest in ${{ runner.temp }}/digests/digest-ryjson-*; do
echo "Adding $(cat $digest)"
buildah manifest add $MANIFEST $FULL_IMAGE_NAME@$(cat $digest)
done
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:${{ env.REELAY_VERSION }}
if [ "${{ env.REELAY_VERSION }}" == "${{ env.REELAY_LATEST_VERSION }}" ]; then
buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest
fi