Skip to content

Commit

Permalink
ci: push individual arch digest only and merge from digest (#1284)
Browse files Browse the repository at this point in the history
* ci: push individual arch digest only and merge from digest

* ci: correct syntax for docker manifest

* ci: add the missing id to the build step

* ci: set proper ids and output digest that is dependant on matrix.id

* ci: proper dynamic outputs by manually echoing it out

* ci: remove unnecessary test step
  • Loading branch information
fallenbagel authored Jan 18, 2025
1 parent ca73931 commit 396cd96
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ jobs:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Sanitize Owner and Platform name
run: |
echo "OWNER_LC=$(echo '${OWNER}' | tr '[:upper:]' '[:lower:]')" >>${GITHUB_ENV}
echo "PLATFORM=$(echo '${PLATFORM}' | sed 's|/|-|g')" >>${GITHUB_ENV}
env:
OWNER: 'Fallenbagel'
PLATFORM: 'linux/amd64'
- name: Test Sanitized Variables
run: |
echo "Sanitized Owner: $OWNER_LC"
echo "Sanitized Platform: $PLATFORM"
- name: Install dependencies
env:
HUSKY: 0
Expand All @@ -65,6 +54,9 @@ jobs:
- runner: ubuntu-24.04-arm
platform: linux/arm64
runs-on: ${{ matrix.runner }}
outputs:
digest-amd64: ${{ steps.set_outputs.outputs.digest-amd64 }}
digest-arm64: ${{ steps.set_outputs.outputs.digest-arm64 }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -86,7 +78,18 @@ jobs:
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: ${{ github.repository_owner }}
- name: Build and push temp platform image
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
fallenbagel/jellyseerr
ghcr.io/${{ env.OWNER_LC }}/jellyseerr
tags: |
type=ref,event=branch
type=sha,prefix=,suffix=,format=short
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: .
Expand All @@ -95,12 +98,17 @@ jobs:
push: true
build-args: |
COMMIT_TAG=${{ github.sha }}
tags: |
fallenbagel/jellyseerr:temp-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
ghcr.io/${{ env.OWNER_LC }}/jellyseerr:temp-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
outputs: |
type=image,push-by-digest=true,name=fallenbagel/jellyseerr,push=true
type=image,push-by-digest=true,name=ghcr.io/${{ env.OWNER_LC }}/jellyseerr,push=true
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
provenance: false
- name: Set outputs
id: set_outputs
run: |
platform="${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}"
echo "digest-${platform}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
merge_and_push:
name: Create and Push Multi-arch Manifest
Expand All @@ -126,14 +134,14 @@ jobs:
- name: Create and push manifest
run: |
docker manifest create fallenbagel/jellyseerr:develop \
fallenbagel/jellyseerr:temp-amd64 \
fallenbagel/jellyseerr:temp-arm64
--amend fallenbagel/jellyseerr@${{ needs.build.outputs.digest-amd64 }} \
--amend fallenbagel/jellyseerr@${{ needs.build.outputs.digest-arm64 }}
docker manifest push fallenbagel/jellyseerr:develop
# GHCR manifest
docker manifest create ghcr.io/${{ env.OWNER_LC }}/jellyseerr:develop \
ghcr.io/${{ env.OWNER_LC }}/jellyseerr:temp-amd64 \
ghcr.io/${{ env.OWNER_LC }}/jellyseerr:temp-arm64
--amend ghcr.io/${{ env.OWNER_LC }}/jellyseerr@${{ needs.build.outputs.digest-amd64 }} \
--amend ghcr.io/${{ env.OWNER_LC }}/jellyseerr@${{ needs.build.outputs.digest-arm64 }}
docker manifest push ghcr.io/${{ env.OWNER_LC }}/jellyseerr:develop
discord:
Expand Down

0 comments on commit 396cd96

Please sign in to comment.