From 9ddd04c88882fc1faf0e58f81f7ebb1252b03f7e Mon Sep 17 00:00:00 2001 From: Peter Dedene Date: Thu, 4 Jul 2024 19:13:54 +0200 Subject: [PATCH] Another attempt --- .github/workflows/build.yml | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 327f239..01678cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,8 @@ jobs: include: - os: ubuntu-latest platform: linux/amd64 - # - os: ubuntu-22.04-arm - # platform: linux/arm64 + - os: ubuntu-22.04-arm + platform: linux/arm64 permissions: id-token: write # keyless Cosign signatures @@ -64,7 +64,7 @@ jobs: echo "branch=$(echo ${GIT_REF,,} | sed 's/[^a-zA-Z0-9]/-/g')" | tee -a $GITHUB_OUTPUT - name: Generate Docker metadata with ruby version - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 id: metadata with: flavor: | @@ -101,7 +101,6 @@ jobs: uses: docker/build-push-action@v6 id: build with: - tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} build-args: | BUILD_AT=${{ steps.prepare.outputs.today }} @@ -152,14 +151,37 @@ jobs: pattern: digests-${{ matrix.ruby }}-${{ matrix.debian }}-* merge-multiple: true + - name: Parse ruby version + id: prepare + run: | + RUBY_VERSION=$(grep -Eo 'RUBY_VERSION ${{ matrix.ruby }}.[0-9]+$' Dockerfile | cut -d ' ' -f2) + MAJOR=$(echo $RUBY_VERSION | cut -d . -f 1) + MINOR=$(echo $RUBY_VERSION | cut -d . -f 2) + PATCH=$(echo $RUBY_VERSION | cut -d . -f 3) + TODAY=$(date +%Y-%m-%d) + echo "major=$MAJOR" | tee -a $GITHUB_OUTPUT + echo "minor=$MINOR" | tee -a $GITHUB_OUTPUT + echo "patch=$PATCH" | tee -a $GITHUB_OUTPUT + echo "version=$RUBY_VERSION" | tee -a $GITHUB_OUTPUT + echo "today=${TODAY}" | tee -a $GITHUB_OUTPUT + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Docker meta - id: meta + - name: Generate Docker metadata with ruby version uses: docker/metadata-action@v5 + id: metadata with: - images: ${{ env.REGISTRY_IMAGE }} + flavor: | + latest=${{ matrix.ruby == '3.3' }} + images: | + docker.io/${{ env.REGISTRY_IMAGE }} + ghcr.io/${{ env.REGISTRY_IMAGE }} + tags: | + type=semver,pattern={{version}},value=v${{ steps.prepare.outputs.version }} + type=semver,pattern={{major}}.{{minor}},value=v${{ steps.prepare.outputs.version }} + labels: | + org.opencontainers.image.title=ruby - name: Login to Docker Hub uses: docker/login-action@v3