Skip to content

Commit

Permalink
Added arm64 build (#4)
Browse files Browse the repository at this point in the history
* Added arm64 build
  • Loading branch information
ClemensElflein authored Feb 7, 2025
1 parent 6b40a7e commit 37c1d2e
Showing 1 changed file with 88 additions and 5 deletions.
93 changes: 88 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.1
artifacts:
build:
name: "Build Artifacts"
needs: pre-commit
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
tagged-release:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
needs: artifacts
needs: build
steps:
- name: Download artifacts from build stage
uses: actions/download-artifact@v4
Expand All @@ -70,12 +70,28 @@ jobs:
build-host-docker:
name: "Build Host Software Docker Image"
needs: pre-commit
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-24.04-arm, ubuntu-24.04 ]
include:
- os: ubuntu-24.04-arm
docker_build_arch: arm64
- os: ubuntu-24.04
docker_build_arch: amd64
defaults:
run:
working-directory: ./host-software
steps:
- uses: actions/checkout@v4
- name: Prepare
env:
REPOSITORY: '${{ github.repository }}'
run: |
build_arch=${{ matrix.docker_build_arch }}
echo "BUILD_ARCH=${build_arch//\//-}" >> ${GITHUB_ENV}
echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -89,14 +105,81 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
images: ghcr.io/${{ github.REPOSITORY_LC }}
- name: Build and push
id: build-and-push
uses: docker/build-push-action@v5
with:
context: host-software
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.docker_build_arch }}
outputs: type=image,name=ghcr.io/${{ env.REPOSITORY_LC }},push-by-digest=true,name-canonical=true,push=true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build-and-push.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.BUILD_ARCH }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-24.04
needs:
- build-host-docker
steps:
- name: Prepare
env:
REPOSITORY: '${{ github.repository }}'
run: |
echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
- 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:
# generate Docker tags based on the following events/attributes
tags: |
type=edge,branch=main,prefix=releases-
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
images: ghcr.io/${{ env.REPOSITORY_LC }}

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_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 'ghcr.io/${{ env.REPOSITORY_LC }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ghcr.io/${{ env.REPOSITORY_LC }}:${{ steps.meta.outputs.version }}

0 comments on commit 37c1d2e

Please sign in to comment.