Skip to content

gh/workflows: Fix display img digest step #9

gh/workflows: Fix display img digest step

gh/workflows: Fix display img digest step #9

Workflow file for this run

name: Image Release Build
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
jobs:
build-and-push:
if: ${{ github.repository == 'cilium/alpine-curl' }}
environment: release
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- name: alpine-curl
dockerfile: ./Dockerfile
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb
- name: Login to quay.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
registry: quay.io
username: ${{ secrets.QUAY_RELEASE_ALPINE_CURL_USERNAME }}
password: ${{ secrets.QUAY_RELEASE_ALPINE_CURL_PASSWORD }}
- name: Getting image tag
id: tag
run: |
echo tag=${GITHUB_REF##*/} >> $GITHUB_OUTPUT
- name: Checkout Source Code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
- name: Release Build ${{ matrix.name }}
uses: docker/build-push-action@94f8f8c2eec4bc3f1d78c1755580779804cb87b2
id: docker_build_release
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
platforms: linux/amd64,linux/arm64
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ steps.tag.outputs.tag }}
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ github.sha }}
- name: Image Release Digest
shell: bash
run: |
mkdir -p image-digest/
job_name=${{ matrix.name }}
job_name_capital=${job_name^^}
job_name_underscored=${job_name_capital//-/_}
echo "${job_name_underscored}_DIGEST := \"${{ steps.docker_build_release.outputs.digest }}\"" > image-digest/makefile-digest.txt
echo "### ${{ matrix.name }}" > image-digest/${{ matrix.name }}.txt
echo "" >> image-digest/${{ matrix.name }}.txt
echo "\`quay.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ steps.tag.outputs.tag }}@${{ steps.docker_build_release.outputs.digest }}\`" >> image-digest/${{ matrix.name }}.txt
echo "" >> image-digest/${{ matrix.name }}.txt
# Upload artifact digests
- name: Upload artifact digests
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: image-digest ${{ matrix.name }}
path: image-digest
retention-days: 1
image-digests:
if: ${{ github.repository == 'cilium/alpine-curl' }}
name: Display Digests
runs-on: ubuntu-20.04
needs: build-and-push
steps:
- name: Downloading Image Digests
shell: bash
run: |
mkdir -p image-digest/
- name: Download digests of all images built
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427
with:
path: image-digest/
pattern: "*image-digest *"
- name: Image Digests Output
shell: bash
run: |
cd image-digest/
find -type f | sort | xargs -d '\n' cat