diff --git a/.github/workflows/common/set_netdaemon_version.yml b/.github/workflows/common/set_netdaemon_version.yml new file mode 100644 index 000000000..78f0a0bed --- /dev/null +++ b/.github/workflows/common/set_netdaemon_version.yml @@ -0,0 +1,15 @@ +on: + workflow_call: +inputs: + version: + required: true + type: string +jobs: + set_version_in_source: + name: 📆 Set version in code and docker files + runs-on: ubuntu-latest + steps: + run: | + echo setting source version: ${{ inputs.version }} + sed -i '/ private const string Version = /c\ private const string Version = "${{ inputs.version }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs + sed -i '/ io.hass.version=/c\ io.hass.version="${{ inputs.version }}"' ${{github.workspace}}/Dockerfile.AddOn \ No newline at end of file diff --git a/.github/workflows/push_docker_dev.yml b/.github/workflows/push_docker_dev.yml index b68289660..e6a4a5bb2 100644 --- a/.github/workflows/push_docker_dev.yml +++ b/.github/workflows/push_docker_dev.yml @@ -1,5 +1,5 @@ #### Publish tags to docker hub -name: 📦 Deploy dev and appmodel docker +name: 📦 Deploy dev docker on: push: branches: @@ -14,9 +14,9 @@ jobs: - name: 📤 Checkout the repository uses: actions/checkout@main - name: 📆 Set version number - run: | - sed -i '/ private const string Version = /c\ private const string Version = "dev";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs - sed -i '/ io.hass.version=/c\ io.hass.version="dev" \\' ${{github.workspace}}/Dockerfile.AddOn + uses: net-daemon/netdaemon/.github/workflows/common/set_netdaemon_version.yml + with: + version: dev - name: 📎 Set up QEMU uses: docker/setup-qemu-action@v1 - name: 🔧 Set up Docker Buildx diff --git a/.github/workflows/push_docker_manual.yml b/.github/workflows/push_docker_manual.yml index fa528eb23..6416a8747 100644 --- a/.github/workflows/push_docker_manual.yml +++ b/.github/workflows/push_docker_manual.yml @@ -17,9 +17,9 @@ jobs: - name: 📤 Checkout the repository uses: actions/checkout@main - name: 📆 Set version number - run: | - sed -i '/ private const string Version = /c\ private const string Version = "feature-${{ github.event.inputs.tag }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs - sed -i '/ io.hass.version=/c\ io.hass.version="feature-${{ github.event.inputs.tag }}" \\' ${{github.workspace}}/Dockerfile.AddOn + uses: net-daemon/netdaemon/.github/workflows/common/set_netdaemon_version.yml + with: + version: feature-${{ github.event.inputs.tag }} - name: 📎 Set up QEMU uses: docker/setup-qemu-action@v1 - name: 🔧 Set up Docker Buildx diff --git a/.github/workflows/tags_docker.yml b/.github/workflows/tags_docker.yml index badcdf46d..67e34d269 100644 --- a/.github/workflows/tags_docker.yml +++ b/.github/workflows/tags_docker.yml @@ -21,9 +21,9 @@ jobs: echo Current version: $latest echo "::set-output name=version::$latest" - name: 📆 Set version number - run: | - sed -i '/ private const string Version = /c\ private const string Version = "${{ steps.version.outputs.version }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs - sed -i '/ io.hass.version=/c\ io.hass.version="${{ steps.version.outputs.version }}" \\' ${{github.workspace}}/Dockerfile.AddOn + uses: net-daemon/netdaemon/.github/workflows/common/set_netdaemon_version.yml + with: + version: ${{ steps.version.outputs.version }} - name: 📎 Set up QEMU uses: docker/setup-qemu-action@v1 - name: 🔧 Set up Docker Buildx