Skip to content

Commit e7b8487

Browse files
committed
Added possibility to do pre-releases of docker containers
1 parent 4d5e188 commit e7b8487

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
2+
#### Publish tags to docker hub
3+
name: 📦 Deploy pre-release to Docker with tag
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
pre:
8+
type: choice
9+
description: Pre-release tag
10+
required: true
11+
options:
12+
- alpha
13+
- beta
14+
- rc
15+
jobs:
16+
deploy_docker:
17+
name: 📦 Deploy to Docker with tag
18+
runs-on: ubuntu-latest
19+
environment: CI - release environment
20+
steps:
21+
- name: 📤 Checkout the repository
22+
uses: actions/checkout@main
23+
- name: 📆 Set version number
24+
run: |
25+
echo setting source version: ${{ github.event.inputs.pre }}
26+
sed -i '/ private const string Version = /c\ private const string Version = "${{ github.event.inputs.pre }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
27+
sed -i '/ io.hass.version=/c\ io.hass.version="${{ github.event.inputs.pre }}"' ${{github.workspace}}/Dockerfile.AddOn
28+
- name: 📎 Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
- name: 🔧 Set up Docker Buildx
31+
id: buildx
32+
uses: docker/setup-buildx-action@v3
33+
- name: 🧰 Available platforms
34+
run: echo ${{ steps.buildx.outputs.platforms }}
35+
36+
- name: 🔓 Login to Docker hub
37+
uses: docker/[email protected]
38+
with:
39+
username: ${{ secrets.DOCKER_USERNAME }}
40+
password: ${{ secrets.DOCKER_TOKEN }}
41+
- name: 🔓 Login to GitHub Container Registry
42+
uses: docker/[email protected]
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.repository_owner }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
- name: 🛠️ Run Buildx
48+
run: |
49+
docker buildx build \
50+
--platform linux/arm,linux/arm64,linux/amd64 \
51+
--output "type=image,push=true" \
52+
--no-cache \
53+
--file ./Dockerfile . \
54+
--compress \
55+
--tag "netdaemon/netdaemon:${{ github.event.inputs.pre }}" \
56+
--tag "ghcr.io/net-daemon/netdaemon:${{ github.event.inputs.pre }}"
57+
deploy_docker_addon:
58+
name: 📦 Deploy to Docker add-on with tag
59+
runs-on: ubuntu-latest
60+
environment: CI - release environment
61+
steps:
62+
- name: 📤 Checkout the repository
63+
uses: actions/checkout@main
64+
- name: 📆 Set version number
65+
run: |
66+
echo setting source version: {{ github.event.inputs.pre }}
67+
sed -i '/ private const string Version = /c\ private const string Version = "feature-${{ github.event.inputs.pre }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
68+
sed -i '/ io.hass.version=/c\ io.hass.version="feature-${{ github.event.inputs.pre }}"' ${{github.workspace}}/Dockerfile.AddOn
69+
- name: 📎 Set up QEMU
70+
uses: docker/setup-qemu-action@v1
71+
- name: 🔧 Set up Docker Buildx
72+
id: buildx
73+
uses: docker/setup-buildx-action@v1
74+
- name: 🧰 Available platforms
75+
run: echo ${{ steps.buildx.outputs.platforms }}
76+
77+
- name: 🔓 Login to Docker hub
78+
uses: docker/[email protected]
79+
with:
80+
username: ${{ secrets.DOCKER_USERNAME }}
81+
password: ${{ secrets.DOCKER_TOKEN }}
82+
- name: 🔓 Login to GitHub Container Registry
83+
uses: docker/[email protected]
84+
with:
85+
registry: ghcr.io
86+
username: ${{ github.repository_owner }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
- name: 🛠️ Run Buildx
89+
run: |
90+
docker buildx build \
91+
--platform linux/arm,linux/arm64,linux/amd64 \
92+
--output "type=image,push=true" \
93+
--no-cache \
94+
--file ./Dockerfile.AddOn . \
95+
--compress \
96+
--tag "netdaemon/netdaemon_addon:${{ github.event.inputs.pre }}" \
97+
--tag "ghcr.io/net-daemon/netdaemon_addon:${{ github.event.inputs.pre }}"

0 commit comments

Comments
 (0)