Skip to content

Commit e695ed0

Browse files
committed
Add extra arguments
1 parent 42812f1 commit e695ed0

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

.github/workflows/build-archlinuxarm.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ on:
55
branches:
66
- main
77
workflow_dispatch:
8+
inputs:
9+
setup_args:
10+
description: "Arguments to pass to setup-arch.sh (e.g. extra packages)"
11+
required: false
12+
default: ""
13+
name:
14+
description: "Optional image tag name (adds an extra tag)"
15+
required: false
16+
default: ""
817
schedule:
918
- cron: '0 15 * * 5'
1019

@@ -42,7 +51,7 @@ jobs:
4251
docker run --rm --platform "${PLATFORM}" \
4352
-v "$(pwd)/${PLATFORM}:/mnt" \
4453
-v "$(pwd)/setup-arch.sh:/setup-arch.sh" \
45-
--privileged alpine /setup-arch.sh
54+
--privileged alpine /setup-arch.sh ${{ github.event.inputs.setup_args }}
4655
4756
- name: Prepare rootfs (aarch64)
4857
env:
@@ -53,16 +62,23 @@ jobs:
5362
docker run --rm --platform "${PLATFORM}" \
5463
-v "$(pwd)/${PLATFORM}:/mnt" \
5564
-v "$(pwd)/setup-arch.sh:/setup-arch.sh" \
56-
--privileged alpine /setup-arch.sh
65+
--privileged alpine /setup-arch.sh ${{ github.event.inputs.setup_args }}
5766
5867
- name: Build and push multi-arch image
5968
env:
6069
IMAGE: ghcr.io/${{ github.repository_owner }}/docker-archlinuxarm
6170
run: |
6271
set -euxo pipefail
6372
sudo --preserve-env=DOCKER_CONFIG docker buildx create --name rootbuilder --use
64-
DATE_TAG="$(date -u +%F)"
65-
sudo --preserve-env=DOCKER_CONFIG docker buildx build --platform linux/arm64,linux/arm/v7 . -t $IMAGE:${DATE_TAG} -t $IMAGE:latest --push
73+
DATE="$(date -u +%F)"
74+
NAME_TAG="${{ github.event.inputs.name }}"
75+
if [ -n "${NAME_TAG}" ]; then
76+
EXTRA_TAG="$IMAGE:${NAME_TAG}"
77+
DATE_TAG="$IMAGE:${DATE}-${NAME_TAG}"
78+
else
79+
EXTRA_TAG="$IMAGE:latest"
80+
DATE_TAG="$IMAGE:${DATE}"
81+
fi
82+
sudo --preserve-env=DOCKER_CONFIG docker buildx build --platform linux/arm64,linux/arm/v7 . -t ${DATE_TAG} -t ${EXTRA_TAG} --push
6683
67-
# Inspect the pushed image to verify both platforms are present
6884
sudo --preserve-env=DOCKER_CONFIG docker buildx imagetools inspect "$IMAGE:${DATE_TAG}"

0 commit comments

Comments
 (0)