Skip to content

Commit

Permalink
ci: create matrix for building frontend image
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Feb 13, 2023
1 parent b666117 commit 2d0740f
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ jobs:
if: github.event_name != 'schedule'
outputs:
typ: ${{ steps.prep.outputs.typ }}
tag: ${{ steps.prep.outputs.tag }}
push: ${{ steps.prep.outputs.push }}
matrix: ${{ steps.prep.outputs.matrix }}
steps:
-
name: Prepare
Expand All @@ -462,14 +462,30 @@ jobs:
PUSH=push
fi
echo "typ=${TYP}" >>${GITHUB_OUTPUT}
echo "tag=${TAG}" >>${GITHUB_OUTPUT}
echo "push=${PUSH}" >>${GITHUB_OUTPUT}
if [ "${TYP}" = "master" ]; then
echo "matrix=$(jq -cn --arg tag "$TAG" '[$tag, "labs"]')" >>${GITHUB_OUTPUT}
else
echo "matrix=$(jq -cn --arg tag "$TAG" '[$tag]')" >>${GITHUB_OUTPUT}
fi
frontend-image:
runs-on: ubuntu-20.04
if: github.event_name != 'schedule'
needs: [frontend-base, test]
strategy:
fail-fast: false
matrix:
tag: ${{ fromJson(needs.frontend-base.outputs.matrix) }}
steps:
-
name: Prepare
run: |
if [ "${{ matrix.tag }}" = "labs" ]; then
echo "CACHE_SCOPE=frontend-labs" >>${GITHUB_ENV}
else
echo "CACHE_SCOPE=frontend-mainline" >>${GITHUB_ENV}
fi
-
name: Checkout
uses: actions/checkout@v3
Expand All @@ -494,18 +510,10 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build ${{ needs.frontend-base.outputs.typ }}/${{ needs.frontend-base.outputs.tag }}
run: |
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" "${{ needs.frontend-base.outputs.tag }}" "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
env:
PLATFORMS: ${{ env.PLATFORMS }},linux/386,linux/mips,linux/mipsle,linux/mips64,linux/mips64le
CACHE_FROM: type=gha,scope=frontend-${{ needs.frontend-base.outputs.typ }}
CACHE_TO: type=gha,scope=frontend-${{ needs.frontend-base.outputs.typ }}
-
name: Build ${{ needs.frontend-base.outputs.typ }}/labs
if: needs.frontend-base.outputs.typ == 'master'
name: Build
run: |
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" labs "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.frontend-base.outputs.typ }}" "${{ matrix.tag }}" "$DF_REPO_SLUG_TARGET" "${{ needs.frontend-base.outputs.push }}"
env:
PLATFORMS: ${{ env.PLATFORMS }},linux/386,linux/mips,linux/mipsle,linux/mips64,linux/mips64le
CACHE_FROM: type=gha,scope=frontend-${{ needs.frontend-base.outputs.typ }}
CACHE_FROM: type=gha,scope=${{ env.CACHE_SCOPE }}
CACHE_TO: type=gha,scope=${{ env.CACHE_SCOPE }}

0 comments on commit 2d0740f

Please sign in to comment.