diff --git a/.github/workflows/ghcr-image-main-fork.yml b/.github/workflows/ghcr-image-main-fork.yml index def673f694..3ae198bde3 100644 --- a/.github/workflows/ghcr-image-main-fork.yml +++ b/.github/workflows/ghcr-image-main-fork.yml @@ -1,14 +1,20 @@ name: ghcr-image-main on: - push: - branches: - - main - workflow_dispatch: + workflow_call: + inputs: + image-suffix: + required: false + type: string + default: "" + cargo-features: + required: false + type: string + default: "" env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME: ${{ github.repository }}${{ inputs.image-suffix != '' && '/' || '' }}${{ inputs.image-suffix }} IMAGE_TAG: nightly jobs: @@ -23,6 +29,9 @@ jobs: json: ${{ steps.meta.outputs.json }} image-name: ${{ steps.custom-meta.outputs.image-name }} + permissions: + contents: read + steps: - name: Checkout current fork HEAD uses: actions/checkout@v4.1.5 @@ -74,6 +83,10 @@ jobs: needs: - meta + permissions: + contents: read + packages: write + strategy: fail-fast: false matrix: @@ -117,8 +130,9 @@ jobs: with: context: . file: docker/Dockerfile - build-args: + build-args: | RUST_RELEASE_MODE=release + ${{ inputs.cargo-features != '' && format('CARGO_BUILD_FEATURES={0}', inputs.cargo-features) || '' }} platforms: ${{ matrix.platform }} labels: ${{ needs.meta.outputs.labels }} annotations: ${{ needs.meta.outputs.annotations }} @@ -137,7 +151,7 @@ jobs: - name: Upload digest uses: actions/upload-artifact@v4.3.3 with: - name: digests-${{ steps.meta.outputs.platform-pair }} + name: digests-${{ inputs.image-suffix != '' && inputs.image-suffix || '_default_' }}-${{ steps.meta.outputs.platform-pair }} path: /tmp/digests/* if-no-files-found: error retention-days: 1 @@ -162,7 +176,7 @@ jobs: uses: actions/download-artifact@v4.1.7 with: path: /tmp/digests - pattern: digests-* + pattern: digests-${{ inputs.image-suffix != '' && inputs.image-suffix || '_default_' }}-* merge-multiple: true - name: Set up Docker Buildx diff --git a/.github/workflows/ghcr-multi-flavor-builds-fork.yml b/.github/workflows/ghcr-multi-flavor-builds-fork.yml new file mode 100644 index 0000000000..31cad60663 --- /dev/null +++ b/.github/workflows/ghcr-multi-flavor-builds-fork.yml @@ -0,0 +1,27 @@ +name: multi-flavor-builds + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + trigger-alternative-builds: + permissions: + contents: read + packages: write + + strategy: + matrix: + variant: + # default image + - image-suffix: "" + cargo-features: "" + - image-suffix: json-log + cargo-features: json-log + + uses: ./.github/workflows/ghcr-image-main-fork.yml + with: + image-suffix: ${{ matrix.variant.image-suffix }} + cargo-features: ${{ matrix.variant.cargo-features }} diff --git a/.github/workflows/sync-fork.yml b/.github/workflows/sync-fork.yml index fb6b79aa9c..7c2f5a8108 100644 --- a/.github/workflows/sync-fork.yml +++ b/.github/workflows/sync-fork.yml @@ -53,6 +53,6 @@ jobs: uses: benc-uk/workflow-dispatch@25b02cc069be46d637e8fe2f1e8484008e9e9609 # v1.2.3 with: ref: ${{ github.event.repository.default_branch }} - workflow: ghcr-image-main-fork.yml + workflow: ghcr-multi-flavor-builds-fork.yml if: >- fromJSON(steps.check-missing-commits.outputs.commit-count) > 0