From 45a7ccb612fcb66c7961b3e58244cc1c6def928c Mon Sep 17 00:00:00 2001 From: Matthias Freund Date: Tue, 13 Aug 2024 08:31:16 +0200 Subject: [PATCH] Create release.yml --- .github/workflows/release.yml | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..251a9d0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Docker Image CI + +on: + push: + tags: + - "v*" + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - name: Infer the version from the github ref + id: inferVersion + run: | + $prefix = "refs/tags/v" + if (!${env:GITHUB_REF}.StartsWith($prefix)) + { + throw "Unexpected GITHUB_REF: ${env:GITHUB_REF}" + } + + $version = ${env:GITHUB_REF}.Substring($prefix.Length) + Write-Host "The version is: $version" + + if ($version.Contains("'")) + { + throw "Unexpected version containing a single quote: $version" + } + if ($version.Contains('"')) + { + throw "Unexpected version containing a double quote: $version" + } + if ($version.Contains(':')) + { + throw "Unexpected version containing a full colon: $version" + } + + Write-Output "::set-output name=version::$version" + - uses: actions/checkout@v4 + - name: Build the Docker image + run: | + $version = '${{ steps.inferVersion.outputs.version }}' + cd capability-check-node-red + docker build -t node-red-capability-check:$version -f Dockerfile .. + - name: Export the Docker image + run: | + $version = '${{ steps.inferVersion.outputs.version }}' + docker save -o node-red-capability-check_$version.tar node-red-capability-check:$version + - name: Upload the release assets + uses: Hs1r1us/Release-AIO@v2.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "v${{ steps.inferVersion.outputs.version }}" + asset_files: "node-red-capability-check_v${{ steps.inferVersion.outputs.version }}.tar"