Skip to content

fix docs for preset containers (#567) #392

fix docs for preset containers (#567)

fix docs for preset containers (#567) #392

# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Docker Description Publish
on:
push:
branches: ["main"]
permissions: read-all
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 2
- name: Set Matrix data
id: set-matrix
run: |
# Get the list of files changed in the latest commit(s)
changed_files=$(git diff --name-only HEAD~1 ${{ github.sha }} | sed 's|^|./|' | jq -R . | jq -s .)
echo "Changed files: $changed_files"
# If there are changed files, filter the JSON using jq
matrix=$(jq -c --argjson changed "$changed_files" \
'.readmes |= map(select(.fname as $fname | any($changed[]; . == $fname)))' \
.github/dockerhub-readmes.json)
echo "matrix=$matrix" >> $GITHUB_OUTPUT
publish-dockerhub-description:
runs-on: ${{ github.repository_owner == 'intel' && 'intel-ubuntu-latest' || 'ubuntu-latest' }}
needs: setup-matrix
if: ${{ needs.setup-matrix.outputs.matrix != '{"readmes":[]}' }}
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ matrix.readmes.repo-name }}
readme-filepath: ${{ matrix.readmes.fname }}