Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,29 @@ jobs:
build:
name: Invoke build
uses: ./.github/workflows/common.yml
image:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up docker-buildx
uses: docker/setup-buildx-action@v3
- name: Build image to tar
uses: docker/build-push-action@v6
with:
platforms: linux/arm64
push: false
tags: ghcr.io/apple/container-builder-shim/builder:test
outputs: type=oci,dest=container-builder-shim.tar
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: container-builder-shim
path: container-builder-shim.tar
47 changes: 0 additions & 47 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ permissions:

on:
workflow_call:
inputs:
publish:
type: boolean
description: "Publish the built image"
default: false
version:
type: string
description: "Version of the builder image to create"
default: "test"

jobs:
build:
Expand Down Expand Up @@ -43,41 +34,3 @@ jobs:
- name: Test
run: |
make test

image:
# Nested jobs inherit permissions from parent job, so if we need to publish an image,
# the caller must set permissions that include packages: write.
runs-on: ubuntu-latest
needs: [build] # don't build the image if the repo doesn't build
steps:
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up docker-buildx
uses: docker/setup-buildx-action@v3
- name: Build Dockerfile and push image
if: ${{ inputs.publish }}
uses: docker/build-push-action@v6
with:
platforms: linux/arm64
push: true
tags: ghcr.io/apple/container-builder-shim/builder:${{ inputs.version }}
- name: Build image to tar
if: ${{ !inputs.publish }}
uses: docker/build-push-action@v6
with:
platforms: linux/arm64
push: false
tags: ghcr.io/apple/container-builder-shim/builder:${{ inputs.version }}
outputs: type=oci,dest=container-builder-shim.tar
- name: Save artifacts
if: ${{ !inputs.publish }}
uses: actions/upload-artifact@v4
with:
name: container-builder-shim
path: container-builder-shim.tar
26 changes: 22 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,27 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
name: Invoke build and release
uses: ./.github/workflows/common.yml
with:
publish: true
version: ${{ github.ref_name }}
permissions:
contents: read
packages: write
image:
runs-on: ubuntu-latest
needs: [build]
permissions:
packages: write
steps:
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up docker-buildx
uses: docker/setup-buildx-action@v3
- name: Build Dockerfile and push image
uses: docker/build-push-action@v6
with:
platforms: linux/arm64
push: true
tags: ghcr.io/apple/container-builder-shim/builder:${{ github.ref_name }}
Loading