diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 4cf51296cdd..471ba3e9519 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -20,10 +20,6 @@ inputs: tag-suffix: description: "" required: false - allow-push: - description: "" - default: "true" - required: false runs: using: composite @@ -140,7 +136,6 @@ runs: suffix=-devel${{ inputs.tag-suffix }} - name: Docker meta for runtime - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'tag') }} id: meta-runtime uses: docker/metadata-action@v5 with: @@ -148,11 +143,10 @@ runs: tags: ${{ steps.set-docker-tags.outputs.tags }} bake-target: docker-metadata-action-runtime flavor: | - latest=${{ github.event_name == 'push' && github.ref_type == 'tag' }} + latest=auto suffix=-runtime${{ inputs.tag-suffix }} - name: Login to GitHub Container Registry - if: ${{ github.event_name != 'pull_request' }} uses: docker/login-action@v3 with: registry: ghcr.io @@ -160,28 +154,9 @@ runs: password: ${{ github.token }} - name: Build and Push to GitHub Container Registry - if: ${{ github.event_name == 'push' || - github.event_name == 'schedule' || - (github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'registry') }} - uses: docker/bake-action@v5 - with: - push: ${{ inputs.allow-push == 'true' }} - files: | - docker/docker-bake.hcl - ${{ steps.meta-base.outputs.bake-file }} - ${{ steps.meta-autoware-core.outputs.bake-file }} - ${{ steps.meta-autoware-universe.outputs.bake-file }} - ${{ steps.meta-devel.outputs.bake-file }} - ${{ steps.meta-runtime.outputs.bake-file }} - provenance: false - set: | - ${{ inputs.build-args }} - - - name: Build only - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }} uses: docker/bake-action@v5 with: - push: false + push: true files: | docker/docker-bake.hcl ${{ steps.meta-base.outputs.bake-file }} diff --git a/.github/workflows/docker-build-and-push-self-hosted.yaml b/.github/workflows/docker-build-and-push-self-hosted.yaml index 9e675a8519b..36ced590d21 100644 --- a/.github/workflows/docker-build-and-push-self-hosted.yaml +++ b/.github/workflows/docker-build-and-push-self-hosted.yaml @@ -2,19 +2,10 @@ name: docker-build-and-push-self-hosted on: push: + branches: + - main tags: - - openadkit-v*.*.* - schedule: - - cron: 0 0 1,15 * * workflow_dispatch: - inputs: - artifacts-destination: - type: choice - description: Destination for the artifacts - options: - - registry - - tarball - default: tarball jobs: load-env: @@ -58,7 +49,23 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v44 + with: + files: | + *.env + *.repos + .github/actions/docker-build-and-push/action.yaml + .github/workflows/docker-build-and-push*.yaml + ansible-galaxy-requirements.yaml + ansible/** + docker/** + - name: Build 'Autoware' + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: name: ${{ matrix.name }} @@ -75,7 +82,6 @@ jobs: *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-${{ matrix.platform }} tag-prefix: ${{ needs.load-env.outputs.rosdistro }} - allow-push: true - name: Show disk space run: | diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 728bcbde64d..4fe8759ba1a 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -2,19 +2,10 @@ name: docker-build-and-push on: push: + branches: + - main tags: - - openadkit-v*.*.* - schedule: - - cron: 0 0 1,15 * * workflow_dispatch: - inputs: - artifacts-destination: - type: choice - description: Destination for the artifacts - options: - - registry - - tarball - default: tarball jobs: load-env: @@ -53,7 +44,23 @@ jobs: - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v44 + with: + files: | + *.env + *.repos + .github/actions/docker-build-and-push/action.yaml + .github/workflows/docker-build-and-push*.yaml + ansible-galaxy-requirements.yaml + ansible/** + docker/** + - name: Build 'Autoware' + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: name: ${{ matrix.name }} @@ -70,7 +77,6 @@ jobs: *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-${{ matrix.platform }} tag-prefix: ${{ needs.load-env.outputs.rosdistro }} - allow-push: true - name: Show disk space run: |