Skip to content

ci: cleanup files

ci: cleanup files #83

Workflow file for this run

name: Image Building
on:
push:
branches:
- "main"
paths:
- "containers/**"
- ".github/workflows/**"
schedule:
- cron: "0 0 1,15 * *"
jobs:
generate-matrix:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Calculate file differences
if: github.event.push
id: diff
uses: tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959 # v42.0.2
with:
files_yaml: |
containers:
- containers/**
workflows:
- ./.github/workflows/**
- name: Generate Matrix
if: github.event.push
id: matrix
run: |
base_changed=false
docker_changed=false
go_changed=false
node_changed=false
sysdig_changed=false
kubernetes_changed=false
for path in ${{steps.diff.outputs.workflows_all_changed_and_modified_files}}; do
filename=$(basename "${path}")
case ${filename%.*} in
build-base)
base_changed=true
;;
build-docker)
docker_changed=true
;;
build-go)
go_changed=true
;;
build-kubernetes)
kubernetes_changed=true
;;
build-node)
node_changed=true
;;
build-sysdig)
sysdig_changed=true
;;
esac
done
for path in ${{steps.diff.outputs.containers_all_changed_and_modified_files}}; do
foldername=$(echo $path | cut -d / -f 2)
case ${foldername%.*} in
base)
base_changed=true
;;
docker)
docker_changed=true
;;
go)
go_changed=true
;;
kubernetes)
kubernetes_changed=true
;;
node)
node_changed=true
;;
sysdig)
sysdig_changed=true
;;
esac
done
echo "base_changed=${base_changed}" >> $GITHUB_OUTPUT
echo "docker_changed=${docker_changed}" >> $GITHUB_OUTPUT
echo "go_changed=${go_changed}" >> $GITHUB_OUTPUT
echo "kubernetes_changed=${kubernetes_changed}" >> $GITHUB_OUTPUT
echo "node_changed=${node_changed}" >> $GITHUB_OUTPUT
echo "sysdig_changed=${sysdig_changed}" >> $GITHUB_OUTPUT
- name: Matrix for Cron
if: github.event.schedule
id: matrix

Check failure on line 94 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Image Building

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 94, Col: 11): The identifier 'matrix' may not be used more than once within the same scope.
run: |
echo "base_changed=true" >> $GITHUB_OUTPUT
echo "docker_changed=false" >> $GITHUB_OUTPUT
echo "go_changed=false" >> $GITHUB_OUTPUT
echo "kubernetes_changed=false" >> $GITHUB_OUTPUT
echo "node_changed=false" >> $GITHUB_OUTPUT
echo "sysdig_changed=false" >> $GITHUB_OUTPUT
outputs:
base_changed: ${{ steps.matrix.outputs.base_changed }}
docker_changed: ${{ steps.matrix.outputs.docker_changed }}
go_changed: ${{ steps.matrix.outputs.go_changed }}
kubernetes_changed: ${{ steps.matrix.outputs.kubernetes_changed }}
node_changed: ${{ steps.matrix.outputs.node_changed }}
sysdig_changed: ${{ steps.matrix.outputs.sysdig_changed }}
rebuild-base:
needs: generate-matrix
if: needs.generate-matrix.outputs.base_changed == 'true'
uses: ./.github/workflows/build-base.yml
secrets: inherit
rebuild-docker:
needs: generate-matrix
if: needs.generate-matrix.outputs.base_changed == 'false' && needs.generate-matrix.outputs.docker_changed == 'true'
uses: ./.github/workflows/build-docker.yml
secrets: inherit
rebuild-go:
needs: generate-matrix
if: needs.generate-matrix.outputs.base_changed == 'false' && needs.generate-matrix.outputs.go_changed == 'true'
uses: ./.github/workflows/build-go.yml
secrets: inherit
rebuild-kubernetes:
needs: generate-matrix
if: needs.generate-matrix.outputs.base_changed == 'false' && needs.generate-matrix.outputs.kubernetes_changed == 'true'
uses: ./.github/workflows/build-kubernetes.yml
secrets: inherit
rebuild-node:
needs: generate-matrix
if: needs.generate-matrix.outputs.base_changed == 'false' && needs.generate-matrix.outputs.node_changed == 'true'
uses: ./.github/workflows/build-node.yml
secrets: inherit
rebuild-sysdig:
needs: generate-matrix
if: needs.generate-matrix.outputs.base_changed == 'false' && needs.generate-matrix.outputs.sysdig_changed == 'true'
uses: ./.github/workflows/build-sysdig.yml
secrets: inherit