chore:update #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dockerfile Changes | |
on: | |
push: | |
paths: | |
- '**/Dockerfile' | |
- '**/Dockerfile.*' | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
check_dockerfiles: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
uses: tj-actions/changed-files@v45 | |
id: changed-files | |
with: | |
files: | | |
'**/Dockerfile' | |
'**/Dockerfile*' | |
- name: Set matrix | |
id: set-matrix | |
run: | | |
echo "All changed files: ${{ steps.changed-files.outputs.all_changed_files }}" | |
DOCKER_FILES=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq -R -s 'split(" ") | map(select(length>0)) | {dockerfile: map(.)}' | jq '.dockerfile |= map(gsub("\\n"; ""))' -c) | |
echo "List of Dockerfile: $DOCKER_FILES" | |
echo "matrix=$DOCKER_FILES" >> $GITHUB_OUTPUT | |
run_docker_build: | |
needs: check_dockerfiles | |
if: ${{ fromJson(needs.check_dockerfiles.outputs.matrix).dockerfile.length }} > 0 | |
strategy: | |
matrix: ${{ fromJson(needs.check_dockerfiles.outputs.matrix) }} | |
uses: ./.github/workflows/release.yml | |
with: | |
docker_file_name: $(echo ${{ matrix.dockerfile }} | awk -F'/' '{print $NF}') | |
build_context: $(dirname ${{ matrix.dockerfile }}) | |
docker_tags: nightly | |
build_platforms: linux/amd64 | |
secrets: inherit |