Skip to content

Commit

Permalink
🚑 revert to one docker build runner
Browse files Browse the repository at this point in the history
  • Loading branch information
salamaashoush committed Sep 8, 2024
1 parent fda9285 commit b0500ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 84 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-carrots-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"turbo-remote-cache-rs": patch
---

Revert to one docker build runner
92 changes: 8 additions & 84 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:
- main
paths:
- package.json # Please only commit this file, so we don't need to wait for all the other CI jobs to finish.
env:
REGISTRY_IMAGE: salamaashoush/turbo-remote-cache-rs

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -123,7 +122,7 @@ jobs:
*.tar.gz
npm-publish:
name: Publish
name: Npm Publish
if: needs.check.outputs.version_changed == 'true'
needs: [build, check]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -185,31 +184,12 @@ jobs:
fail_on_unmatched_files: true
target_commitish: ${{ github.sha }}

docker-build:
docker:
name: Docker
needs: check
if: needs.check.outputs.version_changed == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

Expand All @@ -222,65 +202,9 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push by digest
id: build
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

docker-merge:
runs-on: ubuntu-latest
needs:
- docker-build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- 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
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
platforms: linux/amd64,linux/arm64
push: true
tags: salamaashoush/turbo-remote-cache-rs:latest

0 comments on commit b0500ca

Please sign in to comment.