mirror of
https://github.com/logos-storage/github-actions.git
synced 2026-01-02 13:13:06 +00:00
fix: make docker reusable workflow more reusable (#11)
This commit is contained in:
parent
b23d031ead
commit
401008d286
17
.github/workflows/docker-reusable.yml
vendored
17
.github/workflows/docker-reusable.yml
vendored
@ -93,7 +93,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
matrix: ${{ steps.matrix.outputs.matrix }}
|
matrix: ${{ steps.matrix.outputs.matrix }}
|
||||||
|
build_id: ${{ steps.build_id.outputs.build_id }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Generate unique build id
|
||||||
|
id: build_id
|
||||||
|
run: echo "build_id=$(openssl rand -hex 5)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Compute matrix
|
- name: Compute matrix
|
||||||
id: matrix
|
id: matrix
|
||||||
uses: fabiocaccamo/create-matrix-action@v5
|
uses: fabiocaccamo/create-matrix-action@v5
|
||||||
@ -104,16 +109,16 @@ jobs:
|
|||||||
|
|
||||||
# Build platform specific image
|
# Build platform specific image
|
||||||
build:
|
build:
|
||||||
|
name: Build ${{ matrix.os }}/${{ matrix.arch }}
|
||||||
|
runs-on: ${{ matrix.builder }}
|
||||||
needs: compute
|
needs: compute
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
include: ${{ fromJson(needs.compute.outputs.matrix) }}
|
include: ${{ fromJson(needs.compute.outputs.matrix) }}
|
||||||
|
|
||||||
name: Build ${{ matrix.os }}/${{ matrix.arch }}
|
|
||||||
runs-on: ${{ matrix.builder }}
|
|
||||||
env:
|
env:
|
||||||
PLATFORM: ${{ format('{0}/{1}', 'linux', matrix.arch) }}
|
PLATFORM: ${{ format('{0}/{1}', 'linux', matrix.arch) }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -175,7 +180,7 @@ jobs:
|
|||||||
- name: Docker - Upload digest
|
- name: Docker - Upload digest
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: digests-${{ matrix.arch }}
|
name: digests-${{ needs.compute.outputs.build_id }}-${{ matrix.arch }}
|
||||||
path: /tmp/digests/*
|
path: /tmp/digests/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
@ -185,7 +190,7 @@ jobs:
|
|||||||
publish:
|
publish:
|
||||||
name: Publish multi-platform image
|
name: Publish multi-platform image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: [build, compute]
|
||||||
steps:
|
steps:
|
||||||
- name: Docker - Variables
|
- name: Docker - Variables
|
||||||
run: |
|
run: |
|
||||||
@ -214,7 +219,7 @@ jobs:
|
|||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: /tmp/digests
|
path: /tmp/digests
|
||||||
pattern: digests-*
|
pattern: digests-${{ needs.compute.outputs.build_id }}-*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Docker - Set up Buildx
|
- name: Docker - Set up Buildx
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user