Skip to content

Commit

Permalink
add docker metadata action to other workflows as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed Apr 30, 2024
1 parent b1f561e commit 805db3d
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 8 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
fi
fi
echo "JLEVEL=${JLEVEL}" >> $GITHUB_ENV
echo "build_datetime=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "build_datetime=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_OUTPUT
echo "build_version=$(grep 'OCCU_VERSION =' buildroot-external/package/occu/occu.mk | cut -d' ' -f3 | cut -d'-' -f1).$(date +%Y%m%d)" >> $GITHUB_OUTPUT
- name: Switch to experimental EULA files
Expand Down Expand Up @@ -300,6 +300,29 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Extract docker metadata
if: github.event.inputs.skip_build == 'false'
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}
labels: |
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.version=${{ env.BUILD_VERSION }}-${{ env.GITHUB_SHA7 }}
org.opencontainers.image.url=https://raspberrymatic.de
org.opencontainers.image.created=${{ env.BUILD_DATETIME }}
annotations: |
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.version=${{ env.BUILD_VERSION }}-${{ env.GITHUB_SHA7 }}
org.opencontainers.image.url=https://raspberrymatic.de
org.opencontainers.image.created=${{ env.BUILD_DATETIME }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index

- name: Build and push container image
if: github.event.inputs.skip_build == 'false'
uses: docker/[email protected]
Expand All @@ -311,12 +334,11 @@ jobs:
# load not supported -> https://github.com/docker/buildx/issues/290
# load: true #load in docker - needed for testing later on
push: ${{ env.SECRETS_ARE_AVAILABLE }}

build-args: |
tar_prefix=RaspberryMatic-${{ env.BUILD_VERSION }}-oci_
labels: |
org.opencontainers.image.title=RaspberryMatic
org.opencontainers.image.description=Alternative OS for your HomeMatic CCU
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.licenses=Apache-2.0
Expand All @@ -335,6 +357,8 @@ jobs:
io.hass.arch=armv7|aarch64|amd64
tags: |
${{ env.CCU_OCI_REPO }}:${{ env.CCU_OCI_TAG }}
annotations: |
${{ steps.meta.outputs.annotations }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Expand All @@ -349,7 +373,6 @@ jobs:
platforms: linux/amd64 # load does not support muti-arch https://github.com/docker/buildx/issues/290
load: true # load in docker - needed for testing later on
push: false

build-args: |
tar_prefix=RaspberryMatic-${{ env.BUILD_VERSION }}-oci_
labels: |
Expand All @@ -373,6 +396,8 @@ jobs:
io.hass.arch=armv7|aarch64|amd64
tags: |
${{ env.CCU_OCI_REPO }}:${{ env.CCU_OCI_TAG }}
annotations: |
${{ steps.meta.outputs.annotations }}
- name: Enable experimental features for the Docker daemon and CLI
run: |
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/oci-repush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Environment
run: |
echo "GIT_REF=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)" >> $GITHUB_ENV
echo "BUILD_DATETIME=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
echo "BUILD_DATETIME=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_ENV
# download OCI platform release assets
- uses: robinraju/[email protected]
Expand Down Expand Up @@ -84,6 +84,28 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Extract docker metadata
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}
labels: |
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.version=${{ env.BUILD_VERSION }}-${{ env.GITHUB_SHA7 }}
org.opencontainers.image.url=https://raspberrymatic.de
org.opencontainers.image.created=${{ env.BUILD_DATETIME }}
annotations: |
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.version=${{ env.BUILD_VERSION }}-${{ env.GITHUB_SHA7 }}
org.opencontainers.image.url=https://raspberrymatic.de
org.opencontainers.image.created=${{ env.BUILD_DATETIME }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index

- name: Build and push container image
uses: docker/[email protected]
id: docker_build
Expand All @@ -96,7 +118,7 @@ jobs:
tar_prefix=RaspberryMatic-${{ github.event.inputs.release_tag }}-oci_
labels: |
org.opencontainers.image.title=RaspberryMatic
org.opencontainers.image.description=Alternative OS for your HomeMatic CCU
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.licenses=Apache-2.0
Expand All @@ -116,6 +138,8 @@ jobs:
tags: |
${{ steps.extract_branch.outputs.unique_tag }}
${{ steps.extract_branch.outputs.branch_tag }}
annotations: |
${{ steps.meta.outputs.annotations }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
fi
echo "JLEVEL=${JLEVEL}" >> $GITHUB_ENV
echo "FAKE_BUILD=${{ github.event.inputs.skip_build }}" >> $GITHUB_ENV
echo "build_datetime=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "build_datetime=$(date -u +'%FT%T.%3NZ')" >> $GITHUB_OUTPUT
# - name: remote debug tmate session
# uses: mxschmitt/action-tmate@v1
Expand Down Expand Up @@ -416,6 +416,28 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Extract docker metadata
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}
labels: |
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.version=${{ needs.release_draft.outputs.version }}
org.opencontainers.image.url=https://raspberrymatic.de
org.opencontainers.image.created=${{ needs.build.outputs.build_datetime }}
annotations: |
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.version=${{ needs.release_draft.outputs.version }}
org.opencontainers.image.url=https://raspberrymatic.de
org.opencontainers.image.created=${{ needs.build.outputs.build_datetime }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index

- name: Build and push container image
if: github.event.inputs.skip_build == 'false'
uses: docker/[email protected]
Expand All @@ -429,7 +451,7 @@ jobs:
tar_prefix=RaspberryMatic-${{ needs.release_draft.outputs.version }}-oci_
labels: |
org.opencontainers.image.title=RaspberryMatic
org.opencontainers.image.description=Alternative OS for your HomeMatic CCU
org.opencontainers.image.description=Alternative OS for your homematicIP CCU
org.opencontainers.image.vendor=RasperryMatic OpenSource Project
org.opencontainers.image.authors=RaspberryMatic OpenSource Team
org.opencontainers.image.licenses=Apache-2.0
Expand All @@ -449,6 +471,8 @@ jobs:
tags: |
${{ steps.extract_branch.outputs.unique_tag }}
${{ steps.extract_branch.outputs.branch_tag }}
annotations: |
${{ steps.meta.outputs.annotations }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
Expand Down

0 comments on commit 805db3d

Please sign in to comment.