Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use action to get image platforms #21

Merged
merged 1 commit into from
Feb 6, 2025
Merged
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
34 changes: 15 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@ on:
schedule:
- cron: '0 0 * * 0'
jobs:
supported-arch-matrix:
name: Supported processor architectures
supported-platform-matrix:
name: Supported processor platforms
runs-on: ubuntu-latest
needs:
- lint-dockerfile
outputs:
arch: ${{ steps.supported-arch-matrix.outputs.arch }}
platform: ${{ steps.supported-platform-matrix.outputs.platform }}
steps:
- uses: actions/checkout@v4
- id: supported-arch-matrix
name: Generate Arch
run: |
echo "arch=[\"linux/amd64\",\"linux/arm64\"]" >> $GITHUB_OUTPUT
- id: supported-platform-matrix
name: Generate platform
uses: WyriHaximus/github-action-oci-image-supported-platforms@main
lint-dockerfile:
name: Lint Dockerfile
runs-on: ubuntu-latest
Expand All @@ -34,9 +30,9 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.supported-arch-matrix.outputs.arch) }}
platform: ${{ fromJson(needs.supported-platform-matrix.outputs.platform) }}
needs:
- supported-arch-matrix
- supported-platform-matrix
- lint-dockerfile
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -66,9 +62,9 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.supported-arch-matrix.outputs.arch) }}
platform: ${{ fromJson(needs.supported-platform-matrix.outputs.platform) }}
needs:
- supported-arch-matrix
- supported-platform-matrix
- build-docker-image
runs-on: ubuntu-latest
steps:
Expand All @@ -87,12 +83,12 @@ jobs:
tests:
name: Test ${{ matrix.platform }}
needs:
- supported-arch-matrix
- supported-platform-matrix
- scan-vulnerability
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.supported-arch-matrix.outputs.arch) }}
platform: ${{ fromJson(needs.supported-platform-matrix.outputs.platform) }}
runs-on: ubuntu-latest
steps:
- name: Prepare
Expand All @@ -113,7 +109,7 @@ jobs:
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/main'
name: Push
needs:
- supported-arch-matrix
- supported-platform-matrix
- tests
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -146,7 +142,7 @@ jobs:
- run: rm -Rf /tmp/docker-image/
- run: docker images
- run: |
archs=${{ join(fromJson(needs.supported-arch-matrix.outputs.arch), ',') }}
archs=${{ join(fromJson(needs.supported-platform-matrix.outputs.platform), ',') }}
for arch in ${archs//,/ }
do
docker tag "${{ env.DOCKER_IMAGE }}:${arch//\//-}" "localhost:5000/${{ env.DOCKER_IMAGE }}:${arch//\//-}"
Expand All @@ -172,4 +168,4 @@ jobs:
context: .
file: docker-file-${{ matrix.registry }}-wyrihaximusnet-github-action-runner
tags: ghcr.io/${{ env.DOCKER_IMAGE }}:latest,ghcr.io/${{ env.DOCKER_IMAGE }}:${{ steps.time.outputs.time }}
platforms: ${{ join(fromJson(needs.supported-arch-matrix.outputs.arch), ',') }}
platforms: ${{ join(fromJson(needs.supported-platform-matrix.outputs.platform), ',') }}