release.yaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. name: release
  2. on:
  3. push:
  4. tags:
  5. - 'v*'
  6. env:
  7. CGO_CFLAGS: '-O3'
  8. CGO_CXXFLAGS: '-O3'
  9. jobs:
  10. setup-environment:
  11. runs-on: ubuntu-latest
  12. environment: release
  13. outputs:
  14. GOFLAGS: ${{ steps.goflags.outputs.GOFLAGS }}
  15. steps:
  16. - uses: actions/checkout@v4
  17. - name: Set environment
  18. id: goflags
  19. run: |
  20. echo GOFLAGS="'-ldflags=-w -s \"-X=github.com/ollama/ollama/version.Version=${GITHUB_REF_NAME#v}\" \"-X=github.com/ollama/ollama/server.mode=release\"'" >>$GITHUB_OUTPUT
  21. darwin-build:
  22. runs-on: macos-13
  23. environment: release
  24. needs: setup-environment
  25. strategy:
  26. matrix:
  27. os: [darwin]
  28. arch: [amd64, arm64]
  29. env:
  30. GOFLAGS: ${{ needs.setup-environment.outputs.GOFLAGS }}
  31. steps:
  32. - uses: actions/checkout@v4
  33. - uses: actions/setup-go@v5
  34. with:
  35. go-version-file: go.mod
  36. - run: |
  37. go build -o dist/ .
  38. env:
  39. GOOS: ${{ matrix.os }}
  40. GOARCH: ${{ matrix.arch }}
  41. CGO_ENABLED: 1
  42. CGO_CPPFLAGS: '-mmacosx-version-min=11.3'
  43. - if: matrix.arch == 'amd64'
  44. run: |
  45. cmake --preset CPU -DCMAKE_OSX_DEPLOYMENT_TARGET=11.3 -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_OSX_ARCHITECTURES=x86_64
  46. cmake --build --parallel --preset CPU
  47. cmake --install build --component CPU --strip --parallel 8
  48. - uses: actions/upload-artifact@v4
  49. with:
  50. name: build-${{ matrix.os }}-${{ matrix.arch }}
  51. path: dist/*
  52. darwin-sign:
  53. runs-on: macos-13
  54. environment: release
  55. needs: darwin-build
  56. steps:
  57. - uses: actions/checkout@v4
  58. - run: |
  59. echo $MACOS_SIGNING_KEY | base64 --decode > certificate.p12
  60. security create-keychain -p password build.keychain
  61. security default-keychain -s build.keychain
  62. security unlock-keychain -p password build.keychain
  63. security import certificate.p12 -k build.keychain -P $MACOS_SIGNING_KEY_PASSWORD -T /usr/bin/codesign
  64. security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password build.keychain
  65. security set-keychain-settings -lut 3600 build.keychain
  66. env:
  67. MACOS_SIGNING_KEY: ${{ secrets.MACOS_SIGNING_KEY }}
  68. MACOS_SIGNING_KEY_PASSWORD: ${{ secrets.MACOS_SIGNING_KEY_PASSWORD }}
  69. - uses: actions/download-artifact@v4
  70. with:
  71. name: build-darwin-amd64
  72. path: dist/darwin-amd64
  73. - uses: actions/download-artifact@v4
  74. with:
  75. name: build-darwin-arm64
  76. path: dist/darwin-arm64
  77. - run: |
  78. export VERSION=${GITHUB_REF_NAME#v}
  79. ./scripts/build_darwin.sh sign macapp
  80. env:
  81. APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
  82. APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
  83. APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }}
  84. APPLE_ID: ${{ vars.APPLE_ID }}
  85. SDKROOT: /Applications/Xcode_14.1.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
  86. DEVELOPER_DIR: /Applications/Xcode_14.1.0.app/Contents/Developer
  87. - uses: actions/upload-artifact@v4
  88. with:
  89. name: dist-darwin
  90. path: |
  91. dist/Ollama-darwin.zip
  92. dist/ollama-darwin.tgz
  93. windows-depends:
  94. strategy:
  95. matrix:
  96. os: [windows]
  97. arch: [amd64]
  98. preset: ['CPU']
  99. include:
  100. - os: windows
  101. arch: amd64
  102. preset: 'CUDA 11'
  103. install: https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.89_win10.exe
  104. cuda-version: '11.3'
  105. - os: windows
  106. arch: amd64
  107. preset: 'CUDA 12'
  108. install: https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_571.96_windows.exe
  109. cuda-version: '12.8'
  110. - os: windows
  111. arch: amd64
  112. preset: 'ROCm 6'
  113. install: https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q4-WinSvr2022-For-HIP.exe
  114. rocm-version: '6.2'
  115. runs-on: ${{ matrix.arch == 'arm64' && format('{0}-{1}', matrix.os, matrix.arch) || matrix.os }}
  116. environment: release
  117. env:
  118. GOFLAGS: ${{ needs.setup-environment.outputs.GOFLAGS }}
  119. steps:
  120. - name: Install system dependencies
  121. run: |
  122. choco install -y --no-progress ccache ninja
  123. ccache -o cache_dir=${{ github.workspace }}\.ccache
  124. - if: startsWith(matrix.preset, 'CUDA ') || startsWith(matrix.preset, 'ROCm ')
  125. id: cache-install
  126. uses: actions/cache/restore@v4
  127. with:
  128. path: |
  129. C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA
  130. C:\Program Files\AMD\ROCm
  131. key: ${{ matrix.install }}
  132. - if: startsWith(matrix.preset, 'CUDA ')
  133. name: Install CUDA ${{ matrix.cuda-version }}
  134. run: |
  135. $ErrorActionPreference = "Stop"
  136. if ("${{ steps.cache-install.outputs.cache-hit }}" -ne 'true') {
  137. Invoke-WebRequest -Uri "${{ matrix.install }}" -OutFile "install.exe"
  138. $subpackages = @("cudart", "nvcc", "cublas", "cublas_dev") | Foreach-Object {"${_}_${{ matrix.cuda-version }}"}
  139. Start-Process -FilePath .\install.exe -ArgumentList (@("-s") + $subpackages) -NoNewWindow -Wait
  140. }
  141. $cudaPath = (Resolve-Path "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\*").path
  142. echo "$cudaPath\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  143. - if: startsWith(matrix.preset, 'ROCm')
  144. name: Install ROCm ${{ matrix.rocm-version }}
  145. run: |
  146. $ErrorActionPreference = "Stop"
  147. if ("${{ steps.cache-install.outputs.cache-hit }}" -ne 'true') {
  148. Invoke-WebRequest -Uri "${{ matrix.install }}" -OutFile "install.exe"
  149. Start-Process -FilePath .\install.exe -ArgumentList '-install' -NoNewWindow -Wait
  150. }
  151. $hipPath = (Resolve-Path "C:\Program Files\AMD\ROCm\*").path
  152. echo "$hipPath\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  153. echo "CC=$hipPath\bin\clang.exe" | Out-File -FilePath $env:GITHUB_ENV -Append
  154. echo "CXX=$hipPath\bin\clang++.exe" | Out-File -FilePath $env:GITHUB_ENV -Append
  155. - if: matrix.preset == 'CPU'
  156. run: |
  157. echo "CC=clang.exe" | Out-File -FilePath $env:GITHUB_ENV -Append
  158. echo "CXX=clang++.exe" | Out-File -FilePath $env:GITHUB_ENV -Append
  159. - if: ${{ !cancelled() && steps.cache-install.outputs.cache-hit != 'true' }}
  160. uses: actions/cache/save@v4
  161. with:
  162. path: |
  163. C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA
  164. C:\Program Files\AMD\ROCm
  165. key: ${{ matrix.install }}
  166. - uses: actions/checkout@v4
  167. - uses: actions/cache@v4
  168. with:
  169. path: ${{ github.workspace }}\.ccache
  170. key: ccache-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.preset }}
  171. - name: Build target "${{ matrix.preset }}"
  172. run: |
  173. Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
  174. Enter-VsDevShell -VsInstallPath 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise' -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -no_logo'
  175. cmake --preset "${{ matrix.preset }}"
  176. cmake --build --parallel --preset "${{ matrix.preset }}"
  177. cmake --install build --component "${{ startsWith(matrix.preset, 'CUDA ') && 'CUDA' || startsWith(matrix.preset, 'ROCm ') && 'HIP' || 'CPU' }}" --strip --parallel 8
  178. env:
  179. CMAKE_GENERATOR: Ninja
  180. - uses: actions/upload-artifact@v4
  181. with:
  182. name: depends-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.preset }}
  183. path: dist\*
  184. windows-build:
  185. strategy:
  186. matrix:
  187. os: [windows]
  188. arch: [amd64, arm64]
  189. runs-on: ${{ matrix.arch == 'arm64' && format('{0}-{1}', matrix.os, matrix.arch) || matrix.os }}
  190. environment: release
  191. needs: [setup-environment]
  192. env:
  193. GOFLAGS: ${{ needs.setup-environment.outputs.GOFLAGS }}
  194. steps:
  195. - name: Install AMD64 system dependencies
  196. if: matrix.arch == 'amd64'
  197. run: |
  198. $ErrorActionPreference = "Stop"
  199. Start-Process "C:\msys64\usr\bin\pacman.exe" -ArgumentList @("-S", "--noconfirm", "mingw-w64-clang-x86_64-gcc-compat", "mingw-w64-clang-x86_64-clang") -NoNewWindow -Wait
  200. echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  201. echo "C:\msys64\clang64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  202. - name: Install ARM64 system dependencies
  203. if: matrix.arch == 'arm64'
  204. run: |
  205. $ErrorActionPreference = "Stop"
  206. Set-ExecutionPolicy Bypass -Scope Process -Force
  207. [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
  208. iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
  209. echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  210. choco install -y --no-progress git gzip
  211. echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  212. Invoke-WebRequest -Uri "https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-ucrt-aarch64.zip" -OutFile "${{ runner.temp }}\llvm-mingw-ucrt-aarch64.zip"
  213. Expand-Archive -Path ${{ runner.temp }}\llvm-mingw-ucrt-aarch64.zip -DestinationPath "C:\Program Files\"
  214. $installPath=(Resolve-Path -Path "C:\Program Files\llvm-mingw-*-ucrt-aarch64").path
  215. echo $installPath\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
  216. - uses: actions/checkout@v4
  217. - uses: actions/setup-go@v5
  218. with:
  219. go-version-file: go.mod
  220. - run: |
  221. go build -o dist/${{ matrix.os }}-${{ matrix.arch }}/ .
  222. - if: matrix.arch == 'arm64'
  223. run: |
  224. Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.arm64.exe" -OutFile "dist\windows-arm64\vc_redist.arm64.exe"
  225. - run: |
  226. $env:VERSION='${{ github.ref_name }}' -Replace "v(.*)", '$1'
  227. & .\scripts\build_windows.ps1 buildApp
  228. env:
  229. VCToolsRedistDir: stub
  230. - uses: actions/upload-artifact@v4
  231. with:
  232. name: build-${{ matrix.os }}-${{ matrix.arch }}
  233. path: |
  234. dist\${{ matrix.os }}-${{ matrix.arch }}\*.exe
  235. dist\${{ matrix.os }}-${{ matrix.arch }}-app.exe
  236. windows-sign:
  237. runs-on: windows-2022
  238. environment: release
  239. needs: [windows-depends, windows-build]
  240. steps:
  241. - uses: actions/checkout@v4
  242. - uses: google-github-actions/auth@v2
  243. with:
  244. project_id: ollama
  245. credentials_json: ${{ secrets.GOOGLE_SIGNING_CREDENTIALS }}
  246. - run: |
  247. $ErrorActionPreference = "Stop"
  248. Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=323507" -OutFile "${{ runner.temp }}\sdksetup.exe"
  249. Start-Process "${{ runner.temp }}\sdksetup.exe" -ArgumentList @("/q") -NoNewWindow -Wait
  250. Invoke-WebRequest -Uri "https://github.com/GoogleCloudPlatform/kms-integrations/releases/download/cng-v1.0/kmscng-1.0-windows-amd64.zip" -OutFile "${{ runner.temp }}\plugin.zip"
  251. Expand-Archive -Path "${{ runner.temp }}\plugin.zip" -DestinationPath "${{ runner.temp }}\plugin\"
  252. & "${{ runner.temp }}\plugin\*\kmscng.msi" /quiet
  253. echo "${{ vars.OLLAMA_CERT }}" >ollama_inc.crt
  254. - uses: actions/download-artifact@v4
  255. with:
  256. pattern: build-windows-*
  257. path: dist\
  258. merge-multiple: true
  259. - uses: actions/download-artifact@v4
  260. with:
  261. pattern: depends-windows-amd64-*
  262. path: dist\windows-amd64\
  263. merge-multiple: true
  264. - run: |
  265. & .\scripts\build_windows.ps1 gatherDependencies sign buildInstaller distZip
  266. env:
  267. KEY_CONTAINER: ${{ vars.KEY_CONTAINER }}
  268. - uses: actions/upload-artifact@v4
  269. with:
  270. name: dist-windows
  271. path: |
  272. dist\OllamaSetup.exe
  273. dist\ollama-windows-*.zip
  274. linux-build:
  275. strategy:
  276. matrix:
  277. include:
  278. - os: linux
  279. arch: amd64
  280. target: archive
  281. - os: linux
  282. arch: amd64
  283. target: rocm
  284. - os: linux
  285. arch: arm64
  286. target: archive
  287. runs-on: ${{ matrix.arch == 'arm64' && format('{0}-{1}', matrix.os, matrix.arch) || matrix.os }}
  288. environment: release
  289. needs: setup-environment
  290. env:
  291. GOFLAGS: ${{ needs.setup-environment.outputs.GOFLAGS }}
  292. steps:
  293. - uses: actions/checkout@v4
  294. - uses: docker/setup-buildx-action@v3
  295. - uses: docker/build-push-action@v6
  296. with:
  297. context: .
  298. platforms: ${{ matrix.os }}/${{ matrix.arch }}
  299. target: ${{ matrix.target }}
  300. build-args: |
  301. GOFLAGS=${{ env.GOFLAGS }}
  302. CGO_CFLAGS=${{ env.CGO_CFLAGS }}
  303. CGO_CXXFLAGS=${{ env.CGO_CXXFLAGS }}
  304. outputs: type=local,dest=dist/${{ matrix.os }}-${{ matrix.arch }}
  305. cache-from: type=registry,ref=ollama/ollama:latest
  306. cache-to: type=inline
  307. - run: |
  308. for COMPONENT in bin/* lib/ollama/*; do
  309. case "$COMPONENT" in
  310. bin/ollama) echo $COMPONENT >>ollama-${{ matrix.os }}-${{ matrix.arch }}.tar.in ;;
  311. lib/ollama/*.so) echo $COMPONENT >>ollama-${{ matrix.os }}-${{ matrix.arch }}.tar.in ;;
  312. lib/ollama/cuda_v11) echo $COMPONENT >>ollama-${{ matrix.os }}-${{ matrix.arch }}.tar.in ;;
  313. lib/ollama/cuda_v12) echo $COMPONENT >>ollama-${{ matrix.os }}-${{ matrix.arch }}.tar.in ;;
  314. lib/ollama/cuda_jetpack5) echo $COMPONENT >>ollama-${{ matrix.os }}-${{ matrix.arch }}-jetpack5.tar.in ;;
  315. lib/ollama/cuda_jetpack6) echo $COMPONENT >>ollama-${{ matrix.os }}-${{ matrix.arch }}-jetpack6.tar.in ;;
  316. lib/ollama/rocm) echo $COMPONENT >>ollama-${{ matrix.os }}-${{ matrix.arch }}-rocm.tar.in ;;
  317. esac
  318. done
  319. working-directory: dist/${{ matrix.os }}-${{ matrix.arch }}
  320. - run: |
  321. for ARCHIVE in dist/${{ matrix.os }}-${{ matrix.arch }}/*.tar.in; do
  322. tar c -C dist/${{ matrix.os }}-${{ matrix.arch }} -T $ARCHIVE --owner 0 --group 0 | pigz -9vc >$(basename ${ARCHIVE//.*/}.tgz);
  323. done
  324. - uses: actions/upload-artifact@v4
  325. with:
  326. name: dist-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.target }}
  327. path: |
  328. *.tgz
  329. # Build each Docker variant (OS, arch, and flavor) separately. Using QEMU is unreliable and slower.
  330. docker-build-push:
  331. strategy:
  332. matrix:
  333. include:
  334. - os: linux
  335. arch: arm64
  336. build-args: |
  337. CGO_CFLAGS
  338. CGO_CXXFLAGS
  339. GOFLAGS
  340. - os: linux
  341. arch: amd64
  342. build-args: |
  343. CGO_CFLAGS
  344. CGO_CXXFLAGS
  345. GOFLAGS
  346. - os: linux
  347. arch: amd64
  348. suffix: '-rocm'
  349. build-args: |
  350. CGO_CFLAGS
  351. CGO_CXXFLAGS
  352. GOFLAGS
  353. FLAVOR=rocm
  354. runs-on: ${{ matrix.arch == 'arm64' && format('{0}-{1}', matrix.os, matrix.arch) || matrix.os }}
  355. environment: release
  356. needs: setup-environment
  357. env:
  358. GOFLAGS: ${{ needs.setup-environment.outputs.GOFLAGS }}
  359. steps:
  360. - uses: actions/checkout@v4
  361. - uses: docker/setup-buildx-action@v3
  362. - uses: docker/login-action@v3
  363. with:
  364. username: ${{ vars.DOCKER_USER }}
  365. password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
  366. - id: build-push
  367. uses: docker/build-push-action@v6
  368. with:
  369. context: .
  370. platforms: ${{ matrix.os }}/${{ matrix.arch }}
  371. build-args: ${{ matrix.build-args }}
  372. outputs: type=image,name=ollama/ollama,push-by-digest=true,name-canonical=true,push=true
  373. cache-from: type=registry,ref=ollama/ollama:latest
  374. cache-to: type=inline
  375. - run: |
  376. mkdir -p ${{ matrix.os }}-${{ matrix.arch }}
  377. echo "${{ steps.build-push.outputs.digest }}" >${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.suffix }}.txt
  378. working-directory: ${{ runner.temp }}
  379. - uses: actions/upload-artifact@v4
  380. with:
  381. name: digest-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.suffix }}
  382. path: |
  383. ${{ runner.temp }}/${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.suffix }}.txt
  384. # Merge Docker images for the same flavor into a single multi-arch manifest
  385. docker-merge-push:
  386. strategy:
  387. matrix:
  388. suffix: ['', '-rocm']
  389. runs-on: linux
  390. environment: release
  391. needs: [docker-build-push]
  392. steps:
  393. - uses: docker/login-action@v3
  394. with:
  395. username: ${{ vars.DOCKER_USER }}
  396. password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
  397. - id: metadata
  398. uses: docker/metadata-action@v4
  399. with:
  400. flavor: |
  401. latest=false
  402. suffix=${{ matrix.suffix }}
  403. images: |
  404. ollama/ollama
  405. tags: |
  406. type=ref,enable=true,priority=600,prefix=pr-,event=pr
  407. type=semver,pattern={{version}}
  408. - uses: actions/download-artifact@v4
  409. with:
  410. pattern: digest-*
  411. path: ${{ runner.temp }}
  412. merge-multiple: true
  413. - run: |
  414. docker buildx imagetools create $(echo '${{ steps.metadata.outputs.json }}' | jq -cr '.tags | map("-t", .) | join(" ")') $(cat *-${{ matrix.suffix }}.txt | xargs printf 'ollama/ollama@%s ')
  415. docker buildx imagetools inspect ollama/ollama:${{ steps.metadata.outputs.version }}
  416. working-directory: ${{ runner.temp }}
  417. # Aggregate all the assets and ship a release
  418. release:
  419. needs: [darwin-sign, windows-sign, linux-build]
  420. runs-on: linux
  421. environment: release
  422. permissions:
  423. contents: write
  424. env:
  425. GH_TOKEN: ${{ github.token }}
  426. steps:
  427. - uses: actions/checkout@v4
  428. - uses: actions/download-artifact@v4
  429. with:
  430. name: dist-darwin
  431. path: dist
  432. - uses: actions/download-artifact@v4
  433. with:
  434. name: dist-windows
  435. path: dist
  436. - uses: actions/download-artifact@v4
  437. with:
  438. pattern: dist-linux-*
  439. path: dist
  440. merge-multiple: true
  441. - run: find . -type f -not -name 'sha256sum.txt' | xargs sha256sum | tee sha256sum.txt
  442. working-directory: dist
  443. - name: Create or update Release
  444. run: |
  445. RELEASE_VERSION="$(echo ${GITHUB_REF_NAME} | cut -f1 -d-)"
  446. echo "Looking for existing release for ${RELEASE_VERSION}"
  447. OLD_TAG=$(gh release ls --json name,tagName | jq -r ".[] | select(.name == \"${RELEASE_VERSION}\") | .tagName")
  448. if [ -n "$OLD_TAG" ]; then
  449. echo "Updating release ${RELEASE_VERSION} to point to new tag ${GITHUB_REF_NAME}"
  450. gh release edit ${OLD_TAG} --tag ${GITHUB_REF_NAME}
  451. else
  452. echo "Creating new release ${RELEASE_VERSION} pointing to tag ${GITHUB_REF_NAME}"
  453. gh release create ${GITHUB_REF_NAME} \
  454. --title ${RELEASE_VERSION} \
  455. --draft \
  456. --generate-notes \
  457. --prerelease
  458. fi
  459. echo "Uploading artifacts for tag ${GITHUB_REF_NAME}"
  460. gh release upload ${GITHUB_REF_NAME} dist/* --clobber