Skip to content

Remove leading 'v' in addon Tag #79

Remove leading 'v' in addon Tag

Remove leading 'v' in addon Tag #79

Workflow file for this run

name: Build and Deploy Dockerimage
on:
push:
tags:
- 'v*'
branches:
- dev
pull_request:
branches:
- dev
types: [opened, labeled, synchronize, reopened, ready_for_review]
jobs:
docker:
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview') }}
runs-on: ubuntu-latest
outputs:
gateway-tags: ${{ steps.bco-gateway-meta.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Docker bco-gateway-homeassistant meta
id: bco-gateway-meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
openbaseorg/bco-gateway-homeassistant
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=preview-{{commit_date 'YYYYMMDD-HHmmss' tz='UTC'}},enable=${{ contains(github.event.pull_request.labels.*.name, 'preview') }}
type=raw,value={{branch}}-{{commit_date 'YYYYMMDD-HHmmss' tz='UTC'}},enable=${{ startsWith(github.ref, 'refs/heads/') }}
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: Build and push bco-gateway-homeassistant
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'preview') }}
tags: ${{ steps.bco-gateway-meta.outputs.tags }}
labels: ${{ steps.bco-gateway-meta.outputs.labels }}
update-addon-version:
name: Update Home Assistant Add-on Version
needs: docker
if: startsWith(github.ref, 'refs/tags/v')
uses: ./.github/workflows/update-addon-version.yaml
with:
version: ${{ github.ref_name }}
addon: "bco-homeassistant"
secrets:
CI_GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
update-addon-version-dev:
name: Update Home Assistant Add-on Version
needs: docker
if: startsWith(github.ref, 'refs/heads/dev')
uses: ./.github/workflows/update-addon-version.yaml
with:
addon: "bco-homeassistant"
tags: ${{ needs.docker.outputs.gateway-tags }}
track: dev
secrets:
CI_GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
update-addon-version-preview:
name: Update Home Assistant Add-on Version
needs: docker
if: contains(github.event.pull_request.labels.*.name, 'preview')
uses: ./.github/workflows/update-addon-version.yaml
with:
addon: "bco-homeassistant"
tags: ${{ needs.docker.outputs.gateway-tags }}
track: preview
secrets:
CI_GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}