Skip to content

Commit

Permalink
Added possibility to do pre-releases of docker containers
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed Oct 23, 2023
1 parent 4d5e188 commit e7b8487
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/push_docker_prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

#### Publish tags to docker hub
name: 📦 Deploy pre-release to Docker with tag
on:
workflow_dispatch:
inputs:
pre:
type: choice
description: Pre-release tag
required: true
options:
- alpha
- beta
- rc
jobs:
deploy_docker:
name: 📦 Deploy to Docker with tag
runs-on: ubuntu-latest
environment: CI - release environment
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main
- name: 📆 Set version number
run: |
echo setting source version: ${{ github.event.inputs.pre }}
sed -i '/ private const string Version = /c\ private const string Version = "${{ github.event.inputs.pre }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
sed -i '/ io.hass.version=/c\ io.hass.version="${{ github.event.inputs.pre }}"' ${{github.workspace}}/Dockerfile.AddOn
- name: 📎 Set up QEMU
uses: docker/setup-qemu-action@v3
- name: 🔧 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: 🧰 Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: 🔓 Login to Docker hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: 🔓 Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🛠️ Run Buildx
run: |
docker buildx build \
--platform linux/arm,linux/arm64,linux/amd64 \
--output "type=image,push=true" \
--no-cache \
--file ./Dockerfile . \
--compress \
--tag "netdaemon/netdaemon:${{ github.event.inputs.pre }}" \
--tag "ghcr.io/net-daemon/netdaemon:${{ github.event.inputs.pre }}"
deploy_docker_addon:
name: 📦 Deploy to Docker add-on with tag
runs-on: ubuntu-latest
environment: CI - release environment
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main
- name: 📆 Set version number
run: |
echo setting source version: {{ github.event.inputs.pre }}
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
sed -i '/ io.hass.version=/c\ io.hass.version="feature-${{ github.event.inputs.pre }}"' ${{github.workspace}}/Dockerfile.AddOn
- name: 📎 Set up QEMU
uses: docker/setup-qemu-action@v1
- name: 🔧 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: 🧰 Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: 🔓 Login to Docker hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: 🔓 Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🛠️ Run Buildx
run: |
docker buildx build \
--platform linux/arm,linux/arm64,linux/amd64 \
--output "type=image,push=true" \
--no-cache \
--file ./Dockerfile.AddOn . \
--compress \
--tag "netdaemon/netdaemon_addon:${{ github.event.inputs.pre }}" \
--tag "ghcr.io/net-daemon/netdaemon_addon:${{ github.event.inputs.pre }}"

0 comments on commit e7b8487

Please sign in to comment.