Split GitHub actions to multiple platforms #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ARM Image Build | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_REGISTRY: hub.docker.com | |
DOCKER_IMAGE: philhawthorne/ha-dockermon | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_TARGET_PLATFORM: linux/arm/v7,linux/arm64 | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v1 | |
- name: Set up Docker Buildx | |
uses: crazy-max/ghaction-docker-buildx@v1 | |
with: | |
version: latest | |
- name: Prepare | |
if: success() | |
id: prepare | |
run: | | |
echo "docker_platform=${DOCKER_TARGET_PLATFORM}" >> "$GITHUB_OUTPUT" | |
echo "docker_image=philhawthorne/ha-dockermon" >> "$GITHUB_OUTPUT" | |
echo "version=${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT" | |
- name: Docker Login | |
if: success() | |
run: | | |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin | |
- name: Push arm-tag | |
if: success() | |
run: | | |
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }}:arm --file ./Dockerfile.RaspberryPi --output type=image,push=true . | |
- name: Push arm-latest tag | |
if: success() | |
run: | | |
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }}:arm-latest --file ./Dockerfile.RaspberryPi --output type=image,push=true . |