-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (87 loc) · 3.24 KB
/
deploy-docker.yml
File metadata and controls
97 lines (87 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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 }}