Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,26 @@ concurrency:
cancel-in-progress: true

jobs:
extract-targets:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.get-targets.outputs.targets }}
steps:
- uses: actions/checkout@v4
- name: Extract targets as JSON array
uses: dcarbone/install-jq-action@v2
- name: Get targets from bake file
id: get-targets
run: |
TARGETS=$(docker buildx bake --file docker-bake.hcl --print | jq -c '[.target | keys[] | select(. != "default")]')
echo "targets=$TARGETS" >> "$GITHUB_OUTPUT"

build:
needs: extract-targets
runs-on: ubuntu-latest
strategy:
matrix:
target: [ "all", "20", "20-alpine", "19", "19-alpine", "18", "18-alpine", "17", "17-alpine", "16", "16-alpine", "15", "14", "13", "12", "11", "10", "9", "8", "7"]
runs-on: ubuntu-latest
target: ${{ fromJson(needs.extract-targets.outputs.targets) }}
steps:
- uses: actions/checkout@v4

Expand All @@ -34,17 +49,18 @@ jobs:
- name: Check formatting
run: make install-deps && make lint

- name: Login container registries
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin

- name: Check buildx bake
run: docker buildx bake --file docker-bake.hcl --print

- name: Build image for tag ${{ matrix.target }}
run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }}

- name: Login container registries
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch'
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u '${{ secrets.DOCKER_USERNAME }}' --password-stdin

- name: Publish image for tag ${{ matrix.target }}
if: github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch'
run: docker buildx bake --file docker-bake.hcl ${{ matrix.target }} --push
Expand Down
18 changes: 9 additions & 9 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ target "all" {
"${GITHUB_REPO}:all"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
output = ["type=image"]
}

target "clang-tools" {
Expand All @@ -65,7 +65,7 @@ target "clang-tools" {
"${GITHUB_REPO}:${tgt}"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
output = ["type=image"]
}

target "clang-tools" {
Expand All @@ -85,7 +85,7 @@ target "clang-tools" {
"${GITHUB_REPO}:${tgt}"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
output = ["type=image"]
}

target "clang-tools" {
Expand All @@ -105,7 +105,7 @@ target "clang-tools" {
"${GITHUB_REPO}:${tgt}"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
output = ["type=image"]
}

target "clang-tools" {
Expand All @@ -124,7 +124,7 @@ target "clang-tools" {
"${GITHUB_REPO}:${tgt}"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
output = ["type=image"]
}

target "clang-tools" {
Expand All @@ -143,7 +143,7 @@ target "clang-tools" {
"${GITHUB_REPO}:${tgt}"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
output = ["type=image"]
}

target "clang-tools" {
Expand All @@ -162,7 +162,7 @@ target "clang-tools" {
"${GITHUB_REPO}:${tgt}"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
output = ["type=image"]
}

target "clang-tools" {
Expand All @@ -180,6 +180,6 @@ target "clang-tools" {
"${DOCKER_REPO}:${tgt}",
"${GITHUB_REPO}:${tgt}"
]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
platforms = ["linux/amd64"]
output = ["type=image"]
}
Loading