Skip to content

Commit

Permalink
Implement additional builds with extra build feature flags for json l…
Browse files Browse the repository at this point in the history
…ogging
  • Loading branch information
Nothing4You authored and github-actions[bot] committed May 24, 2024
1 parent 3fddead commit 7405f1d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
30 changes: 22 additions & 8 deletions .github/workflows/ghcr-image-main-fork.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -74,6 +83,10 @@ jobs:
needs:
- meta

permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/ghcr-multi-flavor-builds-fork.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion .github/workflows/sync-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7405f1d

Please sign in to comment.