From 50dca93ab8036f90f5d444f8407c2b9562366659 Mon Sep 17 00:00:00 2001 From: Viking Studios Date: Fri, 28 Jun 2024 04:50:17 +0100 Subject: [PATCH] fixeeed? --- .github/workflows/ci.yaml | 120 ++------------------------------------ 1 file changed, 4 insertions(+), 116 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4072ccc..ac58d60 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -305,7 +305,6 @@ jobs: echo "repository_lower=$REPOSITORY_LOWER" >> $GITHUB_OUTPUT echo "repository_owner_lower=$REPOSITORY_OWNER_LOWER" >> $GITHUB_OUTPUT - name: Build and Push Docker image - if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v6.2.0 with: push: true @@ -330,36 +329,9 @@ jobs: ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:${{ steps.set_version.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:latest-${{ matrix.architecture }} ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:latest - - name: Build and Push Docker image for other branches - if: github.ref != 'refs/heads/main' - uses: docker/build-push-action@v2 - with: - push: true - context: ./${{ matrix.folder }} - file: ./${{ matrix.folder }}/Dockerfile - platforms: linux/${{ matrix.architecture }} - cache-from: | - type=local,src=/tmp/.docker-cache - format('ghcr.io/{0}/{1}/{2}:edge', github.repository_owner, needs.information.outputs.slug, matrix.architecture) - cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new - build-args: | - BUILD_ARCH=${{ matrix.architecture }} - BUILD_DATE=${{ steps.flags.outputs.date }} - BUILD_DESCRIPTION=${{ needs.information.outputs.description }} - BUILD_FROM=${{ steps.flags.outputs.from }} - BUILD_NAME=${{ needs.information.outputs.name }} - BUILD_REF=${{ github.sha }} - BUILD_REPOSITORY=${{ steps.convert.outputs.repository_lower }} - BUILD_VERSION=${{ needs.information.outputs.version }} - tags: | - ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:${{ steps.set_version.outputs.version }}-${{ matrix.architecture }} - ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:${{ steps.set_version.outputs.version }} - name: Output Image Digests run: | - echo "DIGEST_AMD64=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:amd64)" >> $GITHUB_ENV - echo "DIGEST_ARM64=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:arm64)" >> $GITHUB_ENV - echo "DIGEST_ARMV7=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:armv7)" >> $GITHUB_ENV - echo "DIGEST_I386=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:386)" >> $GITHUB_ENV + echo "DIGEST_${{ matrix.architecture }}=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:${{ matrix.architecture }})" >> $GITHUB_ENV - name: Swap build cache run: | if [ -d /tmp/.docker-cache-new ]; then @@ -369,8 +341,6 @@ jobs: echo "Cache directory /tmp/.docker-cache-new does not exist" fi - - build_other_branches: name: Build ${{ matrix.architecture }} (Other Branches) if: github.event_name == 'push' && github.ref != 'refs/heads/main' @@ -464,7 +434,6 @@ jobs: echo "repository_lower=$REPOSITORY_LOWER" >> $GITHUB_OUTPUT echo "repository_owner_lower=$REPOSITORY_OWNER_LOWER" >> $GITHUB_OUTPUT - name: Build and Push Docker image - if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v6.2.0 with: push: true @@ -489,36 +458,9 @@ jobs: ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:${{ steps.set_version.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:latest-${{ matrix.architecture }} ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:latest - - name: Build and Push Docker image for other branches - if: github.ref != 'refs/heads/main' - uses: docker/build-push-action@v2 - with: - push: true - context: ./${{ matrix.folder }} - file: ./${{ matrix.folder }}/Dockerfile - platforms: linux/${{ matrix.architecture }} - cache-from: | - type=local,src=/tmp/.docker-cache - format('ghcr.io/{0}/{1}/{2}:edge', github.repository_owner, needs.information.outputs.slug, matrix.architecture) - cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new - build-args: | - BUILD_ARCH=${{ matrix.architecture }} - BUILD_DATE=${{ steps.flags.outputs.date }} - BUILD_DESCRIPTION=${{ needs.information.outputs.description }} - BUILD_FROM=${{ steps.flags.outputs.from }} - BUILD_NAME=${{ needs.information.outputs.name }} - BUILD_REF=${{ github.sha }} - BUILD_REPOSITORY=${{ steps.convert.outputs.repository_lower }} - BUILD_VERSION=${{ needs.information.outputs.version }} - tags: | - ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:${{ steps.set_version.outputs.version }}-${{ matrix.architecture }} - ${{ secrets.DOCKER_USERNAME }}/${{ steps.convert.outputs.slug_lower }}:${{ steps.set_version.outputs.version }} - name: Output Image Digests run: | - echo "DIGEST_AMD64=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:amd64)" >> $GITHUB_ENV - echo "DIGEST_ARM64=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:arm64)" >> $GITHUB_ENV - echo "DIGEST_ARMV7=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:armv7)" >> $GITHUB_ENV - echo "DIGEST_I386=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:386)" >> $GITHUB_ENV + echo "DIGEST_${{ matrix.architecture }}=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ secrets.DOCKER_USERNAME }}/${{ needs.information.outputs.slug }}:${{ matrix.architecture }})" >> $GITHUB_ENV - name: Swap build cache run: | if [ -d /tmp/.docker-cache-new ]; then @@ -528,62 +470,6 @@ jobs: echo "Cache directory /tmp/.docker-cache-new does not exist" fi - manifest_main_or_pr: - runs-on: ubuntu-latest - needs: build_main_or_pr - if: github.ref == 'refs/heads/main' - steps: - - name: Log in to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Create and Push Docker Manifest - run: | - docker manifest create ${{ secrets.DOCKER_USERNAME }}/${{ needs.build_main_or_pr.outputs.slug_lower }}:latest \ - --amend $DIGEST_AMD64 \ - --amend $DIGEST_ARM64 \ - --amend $DIGEST_ARMV7 \ - --amend $DIGEST_I386 - docker manifest push ${{ secrets.DOCKER_USERNAME }}/${{ needs.build_main_or_pr.outputs.slug_lower }}:latest - env: - DOCKER_CLI_EXPERIMENTAL: enabled - DIGEST_AMD64: ${{ env.DIGEST_AMD64 }} - DIGEST_ARM64: ${{ env.DIGEST_ARM64 }} - DIGEST_ARMV7: ${{ env.DIGEST_ARMV7 }} - DIGEST_I386: ${{ env.DIGEST_I386 }} - - - manifest_other_branches: - runs-on: ubuntu-latest - needs: build_other_branches - if: github.ref != 'refs/heads/main' - steps: - - name: Log in to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Create and Push Docker Manifest - run: | - docker manifest create ${{ secrets.DOCKER_USERNAME }}/${{ needs.build_other_branches.outputs.slug_lower }}:latest \ - --amend $DIGEST_AMD64 \ - --amend $DIGEST_ARM64 \ - --amend $DIGEST_ARMV7 \ - --amend $DIGEST_I386 - docker manifest push ${{ secrets.DOCKER_USERNAME }}/${{ needs.build_other_branches.outputs.slug_lower }}:latest - env: - DOCKER_CLI_EXPERIMENTAL: enabled - DIGEST_AMD64: ${{ env.DIGEST_AMD64 }} - DIGEST_ARM64: ${{ env.DIGEST_ARM64 }} - DIGEST_ARMV7: ${{ env.DIGEST_ARMV7 }} - DIGEST_I386: ${{ env.DIGEST_I386 }} - - - - update_config_main_or_pr: runs-on: ubuntu-latest needs: build_main_or_pr @@ -612,6 +498,7 @@ jobs: git commit -m "Update config.json with new image URL" git pull --rebase origin ${{ github.ref }} git push + fi update_config_other_branches: runs-on: ubuntu-latest @@ -641,3 +528,4 @@ jobs: git commit -m "Update config.json with new image URL" git pull --rebase origin ${{ github.ref }} git push + fi