5295f3a536
Build Docker Image for Raspberry Pi / build-and-push (push) Failing after 22s
- Sostituito DOCKER_USERNAME/PASSWORD con github.actor/GITEA_TOKEN - Il token GITEA_TOKEN è fornito automaticamente dalle Actions - Non richiede configurazione manuale dei secrets
76 lines
2.1 KiB
YAML
76 lines
2.1 KiB
YAML
name: Build Docker Image for Raspberry Pi
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- develop
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: linux/arm/v6,linux/arm/v7,linux/arm64
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Prepare image name
|
|
id: image-name
|
|
run: |
|
|
# Usa il registry Gitea
|
|
echo "IMAGE_NAME=gitea.home-nas-ds.org/alessio/ha-voltronic-mqtt" >> $GITHUB_OUTPUT
|
|
echo "SHOULD_PUSH=true" >> $GITHUB_OUTPUT
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
gitea.home-nas-ds.org/alessio/ha-voltronic-mqtt
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Login to Gitea Container Registry
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: gitea.home-nas-ds.org
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.multiarch
|
|
platforms: linux/arm/v6,linux/arm/v7,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
BUILD_DATE=${{ github.event.repository.updated_at }}
|
|
VERSION=${{ steps.meta.outputs.version }}
|
|
VCS_REF=${{ github.sha }}
|
|
|
|
- name: Image digest
|
|
run: echo "Tags:" && echo "${{ steps.meta.outputs.tags }}"
|