name: Build Docker image on: workflow_dispatch: workflow_call: secrets: CR_PAT: required: true jobs: variants: strategy: fail-fast: false matrix: runner: ["ubuntu-latest","aarch64"] target: ["debian:bullseye","debian:sid","ubuntu:focal","ubuntu:jammy"] name: ${{ matrix.runner }} ${{ matrix.target }} runs-on: ${{ matrix.runner }} if: ${{ github.repository_owner == 'Armbian' }} steps: - uses: igorpecovnik/freespace@main - name: Checkout repository uses: actions/checkout@v3.1.0 with: repository: armbian/build path: build clean: false - name: Checkout support scripts uses: actions/checkout@v3.1.0 with: repository: armbian/scripts path: scripts clean: false - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.CR_PAT }} - name: Build Docker image run: | # arm64 are only our runners, where we have to clean if [[ "$(dpkg --print-architecture)" == arm64 ]]; then sudo docker stop $(docker ps -a -q) 2>/dev/null || true sudo docker rm $(docker ps -a -q) 2>/dev/null || true sudo docker image rm $(docker images | grep -v latest"-$(dpkg --print-architecture)" | awk 'NR>1 {print $3}') 2> /dev/null || true sudo docker images -a | awk '{print $3}' | xargs docker rmi --force 2>/dev/null || true sudo rm -rf build/userpatches || true fi DISTRO=$(echo ${{ matrix.target }} | cut -d":" -f1) RELEASE=$(echo ${{ matrix.target }} | cut -d":" -f2) echo "RELEASE=$RELEASE" >> $GITHUB_ENV case $RELEASE in bullseye) PACKAGES="g++-10-arm-linux-gnueabihf libssl1.1 qemu" ;; sid) PACKAGES="g++-12-arm-linux-gnueabihf libssl1.1" ;; focal) PACKAGES="g++-8-arm-linux-gnueabihf libssl1.1 qemu" ;; jammy) PACKAGES="g++-12-arm-linux-gnueabihf libssl3 qemu" ;; esac cd build # framework init ./compile.sh JUST_INIT="yes" \ OFFLINE_WORK="yes" \ BRANCH=current \ RELEASE=focal \ BUILD_MINIMAL=yes \ BUILD_DESKTOP=no \ KERNEL_ONLY=no \ KERNEL_CONFIGURE=no \ BOARD="orangepi3" \ NO_HOST_RELEASE_CHECK="yes" # change template sudo sed -i "s/^CUSTOM_PACKAGES=.*/CUSTOM_PACKAGES=\"$PACKAGES\"/" userpatches/config-docker.conf sudo sed -i "s/^BASE_IMAGE=.*/BASE_IMAGE=${DISTRO}:${RELEASE}/" userpatches/config-docker.conf sudo sed -i "s/-it/-i/" userpatches/config-docker.conf touch .ignore_changes ./compile.sh docker \ BOARD=orangepi3 \ BRANCH=current \ RELEASE=focal \ BUILD_MINIMAL=yes \ BUILD_DESKTOP=no \ KERNEL_ONLY=no \ KERNEL_CONFIGURE=no \ COMPRESS_OUTPUTIMAGE=no \ NO_HOST_RELEASE_CHECK=yes \ REPOSITORY_INSTALL="u-boot,kernel,armbian-config,armbian-firmware" \ JUST_INIT=yes - name: Push Docker image run: | # tag #sudo docker tag armbian:$(cat build/VERSION) ghcr.io/armbian/build:$(cat build/VERSION | cut -d"." -f1-2)"-${{ env.RELEASE }}-$(dpkg --print-architecture)" sudo docker tag armbian:$(cat build/VERSION) ghcr.io/armbian/build:latest"-${{ env.RELEASE }}-$(dpkg --print-architecture)" # push #docker push ghcr.io/armbian/build:$(cat build/VERSION | cut -d"." -f1-2)"-${{ env.RELEASE }}-$(dpkg --print-architecture)" docker push ghcr.io/armbian/build:latest"-${{ env.RELEASE }}-$(dpkg --print-architecture)" if [[ ${{ env.RELEASE }} == jammy ]]; then # tag #sudo docker tag armbian:$(cat build/VERSION) ghcr.io/armbian/build:$(cat build/VERSION | cut -d"." -f1-2)"-$(dpkg --print-architecture)" sudo docker tag armbian:$(cat build/VERSION) ghcr.io/armbian/build:latest"-$(dpkg --print-architecture)" # push #docker push ghcr.io/armbian/build:$(cat build/VERSION | cut -d"." -f1-2)"-$(dpkg --print-architecture)" docker push ghcr.io/armbian/build:latest"-$(dpkg --print-architecture)" fi