diff --git a/.github/workflows/image-update.yaml b/.github/workflows/image-update.yaml index f6658e2..e7843f5 100644 --- a/.github/workflows/image-update.yaml +++ b/.github/workflows/image-update.yaml @@ -122,12 +122,14 @@ jobs: echo "$download_test_version - failed; skipping" >&2 continue fi + jsonVersions="${jsonVersions}{\ 'command':'${{matrix.image.command}}',\ 'version':'${versions[$i]}',\ 'latest':'${versions[$((size-1))]}',\ 'digest':'$digest',\ 'checksum':'${{ steps.baseImage.outputs.checksum }}'}" + if (( $i < ($size-1) )); then jsonVersions="${jsonVersions}," fi @@ -185,61 +187,54 @@ jobs: runs-on: ubuntu-latest needs: [read] steps: - - run: | - echo ${{ matrix.image.command }} - echo ${{ matrix.image.version }} - echo ${{ matrix.image.digest }} - echo ${{ matrix.image.checksum }} - echo ${{ matrix.image.latest }} + - uses: actions/checkout@v4 -# - uses: actions/checkout@v4 -# -# - name: Login to DockerHub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_PASSWORD }} -# -# - name: Login to GitHub Container Registry -# uses: docker/login-action@v3 -# with: -# registry: ghcr.io -# username: ${{ github.repository_owner }} -# password: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v3 -# -# - name: Set up Buildx -# uses: docker/setup-buildx-action@v3 -# with: -# buildkitd-flags: --debug -# -# - name: Build and push -# uses: docker/build-push-action@v6 -# env: -# DOCKER_BUILD_RECORD_UPLOAD: false -# with: -# context: ./helm -# platforms: linux/amd64,linux/arm64 -# push: true -# build-args: | -# CHECKSUM=${{ fromJson(needs.read.outputs.result).checksum.helm }} -# REPO_DIGEST=${{ fromJson(needs.read.outputs.result).digest.helm }} -# VERSION=${{ matrix.version }} -# cache-from: type=gha -# cache-to: type=gha,mode=max -# tags: | -# ghcr.io/boxboat/helm:${{ matrix.version }} -# -# - name: Install regctl -# if: ${{ fromJson(needs.read.outputs.result).latest.helm == matrix.version }} -# uses: iarekylew00t/regctl-installer@v3 -# -# - name: Tag latest -# if: ${{ fromJson(needs.read.outputs.result).latest.helm == matrix.version }} -# run: | -# regctl image copy ghcr.io/boxboat/helm:${{ matrix.version }} ghcr.io/boxboat/helm:latest + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + with: + buildkitd-flags: --debug + + - name: Build and push + uses: docker/build-push-action@v6 + env: + DOCKER_BUILD_RECORD_UPLOAD: false + with: + context: ./${{ matrix.image.command }} + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + CHECKSUM=${{ matrix.image.checksum }} + REPO_DIGEST=${{ matrix.image.digest }} + VERSION=${{ matrix.version }} + cache-from: type=gha + cache-to: type=gha,mode=max + tags: | + ghcr.io/boxboat/${{ matrix.image.command }}:${{ matrix.version }} + + - name: Install regctl + if: ${{ matrix.image.version == matrix.image.latest }} + uses: iarekylew00t/regctl-installer@v3 + + - name: Tag latest + if: ${{ matrix.image.version == matrix.image.latest }} + run: | + regctl image copy ghcr.io/boxboat/${{ matrix.image.command }}:${{ matrix.version }} ghcr.io/boxboat/${{ matrix.image.command }}:latest # helm: # strategy: