-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (137 loc) · 4.96 KB
/
deploy-docker.yml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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@v2
-
name: Docker bco meta
id: bco-meta
uses: docker/metadata-action@v3
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@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push bco
uses: docker/build-push-action@v2
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@v3
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/[email protected]
id: short-sha
-
name: Build and push bco device manager
uses: docker/build-push-action@v2
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@v3
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@v2
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 }}