|
| 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 | + |
| 38 | + with: |
| 39 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 40 | + password: ${{ secrets.DOCKER_TOKEN }} |
| 41 | + - name: 🔓 Login to GitHub Container Registry |
| 42 | + |
| 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 | + |
| 79 | + with: |
| 80 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 81 | + password: ${{ secrets.DOCKER_TOKEN }} |
| 82 | + - name: 🔓 Login to GitHub Container Registry |
| 83 | + |
| 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