Skip to content

build

build #80

Workflow file for this run

name: build
on:
push:
branches: master
release:
types: [released]
schedule:
- cron: 0 5 1 * *
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
DOCKER_IMAGE: pkwagner/yasdi2mqtt
DOCKER_PLATFORMS: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: QEMU setup
uses: docker/setup-qemu-action@v3
- name: Docker Buildx setup
uses: docker/setup-buildx-action@v3
with:
version: latest
install: true
- name: Authentication
run: |
echo "${{secrets.DOCKER_TOKEN}}" | docker login --username "${{secrets.DOCKER_USERNAME}}" --password-stdin
- name: Build & Deploy
if: success()
run: |
TAGS="--tag ${DOCKER_IMAGE}:latest"
ALPINE_TAGS="--tag ${DOCKER_IMAGE}:alpine"
if [[ $GITHUB_REF == refs/tags/v* ]]; then
TAGS="$TAGS --tag ${DOCKER_IMAGE}:stable"
TAGS="$TAGS --tag ${DOCKER_IMAGE}:${GITHUB_REF#refs/tags/v}"
ALPINE_TAGS="$ALPINE_TAGS --tag ${DOCKER_IMAGE}:stable-alpine"
ALPINE_TAGS="$ALPINE_TAGS --tag ${DOCKER_IMAGE}:${GITHUB_REF#refs/tags/v}-alpine"
fi
docker build \
--file Dockerfile \
--platform $DOCKER_PLATFORMS \
--push \
$TAGS \
.
docker build \
--file Dockerfile.alpine \
--platform $DOCKER_PLATFORMS \
--push \
$ALPINE_TAGS \
.
- name: Cleanup
if: always()
run: |
rm -f ${HOME}/.docker/config.json