@@ -138,20 +138,36 @@ jobs:
138138 run : |
139139 mkdir backend
140140
141- $RESPONSE=$(curl.exe -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }})
141+ $RESPONSE=$(curl.exe -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" " https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }}" )
142142 $RESPONSE_JSON=($RESPONSE | ConvertFrom-Json)
143143
144- if ($RESPONSE_JSON.assets[0].browser_download_url -match ".exe") {
145- echo $RESPONSE_JSON.assets[0].browser_download_url
146- curl.exe -sL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" $RESPONSE_JSON.assets[0].url -o backend/ame-backend.exe
147- } elseif ($RESPONSE_JSON.assets[1].browser_download_url -match ".exe") {
148- echo $RESPONSE_JSON.assets[1].browser_download_url
149- curl.exe -sL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" $RESPONSE_JSON.assets[1].url -o backend/ame-backend.exe
150- } elseif ($RESPONSE_JSON.assets[2].browser_download_url -match ".exe") {
151- echo $RESPONSE_JSON.assets[2].browser_download_url
152- curl.exe -sL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" $RESPONSE_JSON.assets[2].url -o backend/ame-backend.exe
144+ $url = $null
145+ foreach ($asset in $RESPONSE_JSON.assets) {
146+ if ($asset.browser_download_url -match ".zip") {
147+ $url = $asset.browser_download_url
148+ break
149+ }
153150 }
154151
152+ if ($url -ne $null) {
153+ echo "Downloading: $url"
154+ curl.exe -sL -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" $url -o backend/ame-backend.zip
155+
156+ # Unzip the file into the backend directory
157+ Expand-Archive -Path backend/ame-backend.zip -DestinationPath backend
158+
159+ # Remove the zip file
160+ Remove-Item -Path backend/ame-backend.zip
161+
162+ # Rename the extracted .exe file
163+ $oldName = "backend\ame-backend-${{ github.event.inputs.release_version }}-win.exe"
164+ $newName = "ame-backend.exe"
165+ Rename-Item -Path $oldName -NewName $newName
166+ } else {
167+ Write-Error "No zip file found."
168+ }
169+ shell : pwsh
170+
155171 - name : Install node modules
156172 run : npm install
157173 working-directory : core
0 commit comments