From 10b4d6326bb74b82c9a6d964a1f29041296b7f68 Mon Sep 17 00:00:00 2001 From: Scott Dixon Date: Wed, 3 Apr 2024 22:58:54 -0700 Subject: [PATCH] Forgot to login Adding ghcr login step and retrying release. --- .github/workflows/toolshed.yml | 7 ++++++ .github/workflows/toxic.yml | 40 +++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/toolshed.yml b/.github/workflows/toolshed.yml index ad7868e..09c540c 100644 --- a/.github/workflows/toolshed.yml +++ b/.github/workflows/toolshed.yml @@ -43,6 +43,13 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push by digest id: build uses: docker/build-push-action@v5 diff --git a/.github/workflows/toxic.yml b/.github/workflows/toxic.yml index 048b369..34cbc3a 100644 --- a/.github/workflows/toxic.yml +++ b/.github/workflows/toxic.yml @@ -13,7 +13,7 @@ env: jobs: release-tx: - if: ${{ github.event_name == 'pull_request' || ( github.event_name == 'release' && startsWith( github.ref, 'refs/tags/tx') && github.event.release.prerelease ) }} + if: ${{ github.event_name == 'pull_request' || ( github.event_name == 'release' && startsWith( github.ref, 'refs/tags/tx') ) }} runs-on: ubuntu-latest strategy: matrix: @@ -43,6 +43,13 @@ jobs: name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push by digest id: build uses: docker/build-push-action@v5 @@ -50,17 +57,17 @@ jobs: context: toxic platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.event_name == 'pull_request' && 'false' || 'true' }} - - - name: Export digest - if: ${{ github.event_name != 'pull_request'}} + outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ (github.event_name != 'pull_request' && !github.event.release.prerelease) && 'true' || 'false' }} + + - name: Export digest + if: ${{ github.event_name != 'pull_request' && !github.event.release.prerelease}} run: | mkdir -p /tmp/digests digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - - - name: Upload digest - if: ${{ github.event_name != 'pull_request'}} + + - name: Upload digest + if: ${{ github.event_name != 'pull_request' && !github.event.release.prerelease }} uses: actions/upload-artifact@v4 with: name: digests-${{ env.PLATFORM_PAIR }} @@ -74,19 +81,17 @@ jobs: needs: - release-tx steps: - - - name: Download digests + - name: Download digests uses: actions/download-artifact@v4 with: path: /tmp/digests pattern: digests-* merge-multiple: true - - - name: Set up Docker Buildx + + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: @@ -100,13 +105,12 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Create manifest list and push + - name: Create manifest list and push working-directory: /tmp/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - - - name: Inspect image + + - name: Inspect image run: | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}