diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index aa23627..a127434 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -14,11 +14,7 @@ jobs: changes: runs-on: job-v2 outputs: - base: ${{ steps.filter.outputs.base == 'true' }} - infra: ${{ steps.filter.outputs.infra == 'true' || steps.filter.outputs.base == 'true' }} - go: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.base == 'true' }} - php: ${{ steps.filter.outputs.php == 'true' || steps.filter.outputs.base == 'true' }} - any_change: ${{ steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}} + any_container_change: ${{ steps.filter.outputs.containers == 'true' || steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} steps: - uses: actions/checkout@v6 with: @@ -28,23 +24,22 @@ jobs: with: filters: | workflow: ['.gitea/workflows/build.yaml'] - base: ['containers/base/**'] - infra: ['containers/infra/**'] - go: ['containers/go/**'] - php: ['containers/php/**'] + containers: ['containers/**'] base-image: needs: [changes] - if: ${{ needs.changes.outputs.base == 'true' || needs.changes.outputs.any_change == 'true' }} + if: ${{ needs.changes.outputs.any_container_change == 'true' }} runs-on: job-v2 steps: - uses: actions/checkout@v6 + - name: Log in uses: redhat-actions/podman-login@v1 with: registry: git.plabble.org username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build id: build uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef @@ -54,6 +49,7 @@ jobs: context: ./containers/base containerfiles: ./containers/base/Containerfile platforms: linux/amd64 + - name: Push uses: redhat-actions/push-to-registry@v2 with: @@ -68,33 +64,25 @@ jobs: dependent-images: needs: [changes, base-image] - if: always() && needs.changes.result == 'success' && (needs.base-image.result == 'success' || needs.base-image.result == 'skipped') + if: ${{ needs.changes.outputs.any_container_change == 'true' }} runs-on: job-v2 strategy: fail-fast: false matrix: container: [infra, go, php] steps: - - name: Check if build needed - id: check - run: | - if [[ "${{ matrix.container }}" == "infra" && "${{ needs.changes.outputs.infra }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi - if [[ "${{ matrix.container }}" == "go" && "${{ needs.changes.outputs.go }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi - if [[ "${{ matrix.container }}" == "php" && "${{ needs.changes.outputs.php }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi - if [[ "${{ needs.changes.outputs.any_change }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi - name: Clone repo - if: steps.check.outputs.run == 'true' uses: actions/checkout@v6 + - name: Log in - if: steps.check.outputs.run == 'true' uses: redhat-actions/podman-login@v1 with: registry: git.plabble.org username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build id: build - if: steps.check.outputs.run == 'true' uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef with: image: job79/${{ matrix.container }} @@ -103,8 +91,8 @@ jobs: containerfiles: ./containers/${{ matrix.container }}/Containerfile build-args: TAG=${{ github.ref_name }} platforms: linux/amd64 + - name: Push - if: steps.check.outputs.run == 'true' uses: redhat-actions/push-to-registry@v2 with: image: ${{ steps.build.outputs.image }}