Skip to content

Merge pull request #145 from openbase/feature/updateToJava21 #622

Merge pull request #145 from openbase/feature/updateToJava21

Merge pull request #145 from openbase/feature/updateToJava21 #622

Workflow file for this run

name: Build and Deploy Dockerimage
on:
push:
branches:
- stable
- beta
- dev
tags:
- "v*.*.*"
pull_request:
branches:
- dev
- beta
types: [opened, labeled, synchronize, reopened, ready_for_review]
jobs:
docker:
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker bco meta
id: bco-meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
openbaseorg/bco
ghcr.io/openbase/bco
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=raw,value=review,enable=${{ contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push bco
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
tags: ${{ steps.bco-meta.outputs.tags }}
labels: ${{ steps.bco-meta.outputs.labels }}
env:
TAG: 3.0-alpha
-
name: Docker bco device meta
id: bco-device-meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
openbaseorg/bco-device-manager-openhab
ghcr.io/openbase/bco-device-manager-openhab
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=raw,value=review,enable=${{ contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
uses: benjlevesque/short-sha@v3.0
id: short-sha
-
name: Build and push bco device manager
uses: docker/build-push-action@v5
with:
context: ./docker/device-manager/openhab
build-args: |
BCO_BASE_IMAGE_VERSION=sha-${{ steps.short-sha.outputs.sha }}
file: ./docker/device-manager/openhab/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
tags: ${{ steps.bco-device-meta.outputs.tags }}
labels: ${{ steps.bco-device-meta.outputs.labels }}
-
name: Docker bco demo meta
id: bco-demo-meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
openbaseorg/bco-demo
ghcr.io/openbase/bco-demo
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=raw,value=review,enable=${{ contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
name: Build and push bco demo
uses: docker/build-push-action@v5
with:
context: ./docker/bco-demo
build-args: |
BCO_BASE_IMAGE_VERSION=sha-${{ steps.short-sha.outputs.sha }}
file: ./docker/bco-demo/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'prebuild docker image') }}
tags: ${{ steps.bco-demo-meta.outputs.tags }}
labels: ${{ steps.bco-demo-meta.outputs.labels }}