release.yml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. name: Release
  2. on:
  3. push:
  4. tags: 'v*'
  5. env:
  6. GO_VERSION: 1.21.3
  7. jobs:
  8. prepare-sources-with-deps:
  9. name: Prepare sources with deps
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v4
  13. - name: Set up Go
  14. uses: actions/setup-go@v5
  15. with:
  16. go-version: ${{ env.GO_VERSION }}
  17. - name: Get SFTPGo version
  18. id: get_version
  19. run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
  20. - name: Prepare release
  21. run: |
  22. go mod vendor
  23. echo "${SFTPGO_VERSION}" > VERSION.txt
  24. echo "${GITHUB_SHA::8}" >> VERSION.txt
  25. tar cJvf sftpgo_${SFTPGO_VERSION}_src_with_deps.tar.xz *
  26. env:
  27. SFTPGO_VERSION: ${{ steps.get_version.outputs.VERSION }}
  28. - name: Upload build artifact
  29. uses: actions/upload-artifact@v3
  30. with:
  31. name: sftpgo_${{ steps.get_version.outputs.VERSION }}_src_with_deps.tar.xz
  32. path: ./sftpgo_${{ steps.get_version.outputs.VERSION }}_src_with_deps.tar.xz
  33. retention-days: 1
  34. prepare-window-mac:
  35. name: Prepare binaries
  36. runs-on: ${{ matrix.os }}
  37. strategy:
  38. matrix:
  39. os: [macos-11, windows-2022]
  40. steps:
  41. - uses: actions/checkout@v4
  42. - name: Set up Go
  43. uses: actions/setup-go@v5
  44. with:
  45. go-version: ${{ env.GO_VERSION }}
  46. - name: Get SFTPGo version
  47. id: get_version
  48. run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
  49. shell: bash
  50. - name: Get OS name
  51. id: get_os_name
  52. run: |
  53. if [[ $MATRIX_OS =~ ^macos.* ]]
  54. then
  55. echo "OS=macOS" >> $GITHUB_OUTPUT
  56. else
  57. echo "OS=windows" >> $GITHUB_OUTPUT
  58. fi
  59. shell: bash
  60. env:
  61. MATRIX_OS: ${{ matrix.os }}
  62. - name: Build for macOS x86_64
  63. if: startsWith(matrix.os, 'windows-') != true
  64. run: go build -trimpath -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --abbrev=8 --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
  65. - name: Build for macOS arm64
  66. if: startsWith(matrix.os, 'macos-') == true
  67. run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --abbrev=8 --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
  68. - name: Build for Windows
  69. if: startsWith(matrix.os, 'windows-')
  70. run: |
  71. $GIT_COMMIT = (git describe --always --abbrev=8 --dirty) | Out-String
  72. $DATE_TIME = ([datetime]::Now.ToUniversalTime().toString("yyyy-MM-ddTHH:mm:ssZ")) | Out-String
  73. $FILE_VERSION = $Env:SFTPGO_VERSION.substring(1) + ".0"
  74. go install github.com/tc-hib/go-winres@latest
  75. go-winres simply --arch amd64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
  76. go build -trimpath -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o sftpgo.exe
  77. mkdir arm64
  78. $Env:CGO_ENABLED='0'
  79. $Env:GOOS='windows'
  80. $Env:GOARCH='arm64'
  81. go-winres simply --arch arm64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
  82. go build -trimpath -tags nopgxregisterdefaulttypes,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe
  83. mkdir x86
  84. $Env:GOARCH='386'
  85. go-winres simply --arch 386 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico
  86. go build -trimpath -tags nopgxregisterdefaulttypes,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/internal/version.date=$DATE_TIME" -o .\x86\sftpgo.exe
  87. Remove-Item Env:\CGO_ENABLED
  88. Remove-Item Env:\GOOS
  89. Remove-Item Env:\GOARCH
  90. env:
  91. SFTPGO_VERSION: ${{ steps.get_version.outputs.VERSION }}
  92. - name: Initialize data provider
  93. run: ./sftpgo initprovider
  94. shell: bash
  95. - name: Prepare Release for macOS
  96. if: startsWith(matrix.os, 'macos-')
  97. run: |
  98. mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
  99. echo "For documentation please take a look here:" > output/README.txt
  100. echo "" >> output/README.txt
  101. echo "https://github.com/drakkan/sftpgo/blob/${SFTPGO_VERSION}/README.md" >> output/README.txt
  102. cp LICENSE output/
  103. cp sftpgo output/
  104. cp sftpgo.json output/
  105. cp sftpgo.db output/sqlite/
  106. cp -r static output/
  107. cp -r openapi output/
  108. cp -r templates output/
  109. cp init/com.github.drakkan.sftpgo.plist output/init/
  110. ./sftpgo gen completion bash > output/bash_completion/sftpgo
  111. ./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
  112. ./sftpgo gen man -d output/man/man1
  113. gzip output/man/man1/*
  114. cd output
  115. tar cJvf ../sftpgo_${SFTPGO_VERSION}_${OS}_x86_64.tar.xz *
  116. cd ..
  117. cp sftpgo_arm64 output/sftpgo
  118. cd output
  119. tar cJvf ../sftpgo_${SFTPGO_VERSION}_${OS}_arm64.tar.xz *
  120. cd ..
  121. env:
  122. SFTPGO_VERSION: ${{ steps.get_version.outputs.VERSION }}
  123. OS: ${{ steps.get_os_name.outputs.OS }}
  124. - name: Prepare Release for Windows
  125. if: startsWith(matrix.os, 'windows-')
  126. run: |
  127. mkdir output
  128. copy .\sftpgo.exe .\output
  129. copy .\sftpgo.json .\output
  130. copy .\sftpgo.db .\output
  131. copy .\LICENSE .\output\LICENSE.txt
  132. mkdir output\templates
  133. xcopy .\templates .\output\templates\ /E
  134. mkdir output\static
  135. xcopy .\static .\output\static\ /E
  136. mkdir output\openapi
  137. xcopy .\openapi .\output\openapi\ /E
  138. $CERT_PATH=(Get-Location -PSProvider FileSystem).ProviderPath + "\cert.pfx"
  139. [IO.File]::WriteAllBytes($CERT_PATH,[System.Convert]::FromBase64String($Env:CERT_DATA))
  140. certutil -f -p "$Env:CERT_PASS" -importpfx MY "$CERT_PATH"
  141. rm "$CERT_PATH"
  142. & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\sftpgo.exe
  143. & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\arm64\sftpgo.exe
  144. & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\x86\sftpgo.exe
  145. $INNO_S='/Ssigntool=$qC:/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86/signtool.exe$q sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n $qNicola Murino$q /d $qSFTPGo$q $f'
  146. iscc "$INNO_S" .\windows-installer\sftpgo.iss
  147. rm .\output\sftpgo.exe
  148. rm .\output\sftpgo.db
  149. copy .\arm64\sftpgo.exe .\output
  150. (Get-Content .\output\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\output\sftpgo.json
  151. $Env:SFTPGO_DATA_PROVIDER__DRIVER='bolt'
  152. $Env:SFTPGO_DATA_PROVIDER__NAME='.\output\sftpgo.db'
  153. .\sftpgo.exe initprovider
  154. Remove-Item Env:\SFTPGO_DATA_PROVIDER__DRIVER
  155. Remove-Item Env:\SFTPGO_DATA_PROVIDER__NAME
  156. $Env:SFTPGO_ISS_ARCH='arm64'
  157. iscc "$INNO_S" .\windows-installer\sftpgo.iss
  158. rm .\output\sftpgo.exe
  159. copy .\x86\sftpgo.exe .\output
  160. $Env:SFTPGO_ISS_ARCH='x86'
  161. iscc "$INNO_S" .\windows-installer\sftpgo.iss
  162. certutil -delstore MY "Nicola Murino"
  163. env:
  164. SFTPGO_ISS_VERSION: ${{ steps.get_version.outputs.VERSION }}
  165. SFTPGO_ISS_DOC_URL: https://github.com/drakkan/sftpgo/blob/${{ steps.get_version.outputs.VERSION }}/README.md
  166. CERT_DATA: ${{ secrets.CERT_DATA }}
  167. CERT_PASS: ${{ secrets.CERT_PASS }}
  168. - name: Prepare Portable Release for Windows
  169. if: startsWith(matrix.os, 'windows-')
  170. run: |
  171. mkdir win-portable
  172. copy .\sftpgo.exe .\win-portable
  173. mkdir win-portable\arm64
  174. copy .\arm64\sftpgo.exe .\win-portable\arm64
  175. mkdir win-portable\x86
  176. copy .\x86\sftpgo.exe .\win-portable\x86
  177. copy .\sftpgo.json .\win-portable
  178. (Get-Content .\win-portable\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\win-portable\sftpgo.json
  179. copy .\output\sftpgo.db .\win-portable
  180. copy .\LICENSE .\win-portable\LICENSE.txt
  181. mkdir win-portable\templates
  182. xcopy .\templates .\win-portable\templates\ /E
  183. mkdir win-portable\static
  184. xcopy .\static .\win-portable\static\ /E
  185. mkdir win-portable\openapi
  186. xcopy .\openapi .\win-portable\openapi\ /E
  187. Compress-Archive .\win-portable\* sftpgo_portable.zip
  188. - name: Upload macOS x86_64 artifact
  189. if: startsWith(matrix.os, 'macos-')
  190. uses: actions/upload-artifact@v3
  191. with:
  192. name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86_64.tar.xz
  193. path: ./sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86_64.tar.xz
  194. retention-days: 1
  195. - name: Upload macOS arm64 artifact
  196. if: startsWith(matrix.os, 'macos-')
  197. uses: actions/upload-artifact@v3
  198. with:
  199. name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.tar.xz
  200. path: ./sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.tar.xz
  201. retention-days: 1
  202. - name: Upload Windows installer x86_64 artifact
  203. if: startsWith(matrix.os, 'windows-')
  204. uses: actions/upload-artifact@v3
  205. with:
  206. name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86_64.exe
  207. path: ./sftpgo_windows_x86_64.exe
  208. retention-days: 1
  209. - name: Upload Windows installer arm64 artifact
  210. if: startsWith(matrix.os, 'windows-')
  211. uses: actions/upload-artifact@v3
  212. with:
  213. name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.exe
  214. path: ./sftpgo_windows_arm64.exe
  215. retention-days: 1
  216. - name: Upload Windows installer x86 artifact
  217. if: startsWith(matrix.os, 'windows-')
  218. uses: actions/upload-artifact@v3
  219. with:
  220. name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86.exe
  221. path: ./sftpgo_windows_x86.exe
  222. retention-days: 1
  223. - name: Upload Windows portable artifact
  224. if: startsWith(matrix.os, 'windows-')
  225. uses: actions/upload-artifact@v3
  226. with:
  227. name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_portable.zip
  228. path: ./sftpgo_portable.zip
  229. retention-days: 1
  230. prepare-linux:
  231. name: Prepare Linux binaries
  232. runs-on: ubuntu-latest
  233. strategy:
  234. matrix:
  235. include:
  236. - arch: amd64
  237. distro: ubuntu:18.04
  238. go-arch: amd64
  239. deb-arch: amd64
  240. rpm-arch: x86_64
  241. tar-arch: x86_64
  242. - arch: aarch64
  243. distro: ubuntu18.04
  244. go-arch: arm64
  245. deb-arch: arm64
  246. rpm-arch: aarch64
  247. tar-arch: arm64
  248. - arch: ppc64le
  249. distro: ubuntu18.04
  250. go-arch: ppc64le
  251. deb-arch: ppc64el
  252. rpm-arch: ppc64le
  253. tar-arch: ppc64le
  254. - arch: armv7
  255. distro: ubuntu18.04
  256. go-arch: arm7
  257. deb-arch: armhf
  258. rpm-arch: armv7hl
  259. tar-arch: armv7
  260. steps:
  261. - uses: actions/checkout@v4
  262. - name: Get versions
  263. id: get_version
  264. run: |
  265. echo "SFTPGO_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
  266. echo "GO_VERSION=${GO_VERSION}" >> $GITHUB_OUTPUT
  267. echo "COMMIT=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
  268. shell: bash
  269. env:
  270. GO_VERSION: ${{ env.GO_VERSION }}
  271. - name: Build on amd64
  272. if: ${{ matrix.arch == 'amd64' }}
  273. run: |
  274. echo '#!/bin/bash' > build.sh
  275. echo '' >> build.sh
  276. echo 'set -e' >> build.sh
  277. echo 'apt-get update -q -y' >> build.sh
  278. echo 'apt-get install -q -y curl gcc' >> build.sh
  279. echo 'curl --retry 5 --retry-delay 2 --connect-timeout 10 -o go.tar.gz -L https://go.dev/dl/go${{ steps.get_version.outputs.GO_VERSION }}.linux-${{ matrix.go-arch }}.tar.gz' >> build.sh
  280. echo 'tar -C /usr/local -xzf go.tar.gz' >> build.sh
  281. echo 'export PATH=$PATH:/usr/local/go/bin' >> build.sh
  282. echo 'go version' >> build.sh
  283. echo 'cd /usr/local/src' >> build.sh
  284. echo 'go build -buildvcs=false -trimpath -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=${{ steps.get_version.outputs.COMMIT }} -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo' >> build.sh
  285. chmod 755 build.sh
  286. docker run --rm --name ubuntu-build --mount type=bind,source=`pwd`,target=/usr/local/src ${{ matrix.distro }} /usr/local/src/build.sh
  287. mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
  288. echo "For documentation please take a look here:" > output/README.txt
  289. echo "" >> output/README.txt
  290. echo "https://github.com/drakkan/sftpgo/blob/${SFTPGO_VERSION}/README.md" >> output/README.txt
  291. cp LICENSE output/
  292. cp sftpgo.json output/
  293. cp -r templates output/
  294. cp -r static output/
  295. cp -r openapi output/
  296. cp init/sftpgo.service output/init/
  297. ./sftpgo initprovider
  298. ./sftpgo gen completion bash > output/bash_completion/sftpgo
  299. ./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
  300. ./sftpgo gen man -d output/man/man1
  301. gzip output/man/man1/*
  302. cp sftpgo output/
  303. cp sftpgo.db output/sqlite/
  304. cd output
  305. tar cJvf sftpgo_${SFTPGO_VERSION}_linux_${{ matrix.tar-arch }}.tar.xz *
  306. cd ..
  307. env:
  308. SFTPGO_VERSION: ${{ steps.get_version.outputs.SFTPGO_VERSION }}
  309. - uses: uraimo/run-on-arch-action@v2
  310. if: ${{ matrix.arch != 'amd64' }}
  311. name: Build for ${{ matrix.arch }}
  312. id: build
  313. with:
  314. arch: ${{ matrix.arch }}
  315. distro: ${{ matrix.distro }}
  316. setup: |
  317. mkdir -p "${PWD}/output"
  318. dockerRunArgs: |
  319. --volume "${PWD}/output:/output"
  320. shell: /bin/bash
  321. install: |
  322. apt-get update -q -y
  323. apt-get install -q -y curl gcc xz-utils
  324. GO_DOWNLOAD_ARCH=${{ matrix.go-arch }}
  325. if [ ${{ matrix.arch}} == 'armv7' ]
  326. then
  327. GO_DOWNLOAD_ARCH=armv6l
  328. fi
  329. curl --retry 5 --retry-delay 2 --connect-timeout 10 -o go.tar.gz -L https://go.dev/dl/go${{ steps.get_version.outputs.GO_VERSION }}.linux-${GO_DOWNLOAD_ARCH}.tar.gz
  330. tar -C /usr/local -xzf go.tar.gz
  331. run: |
  332. export PATH=$PATH:/usr/local/go/bin
  333. go version
  334. go build -buildvcs=false -trimpath -tags nopgxregisterdefaulttypes -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=${{ steps.get_version.outputs.COMMIT }} -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
  335. mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
  336. echo "For documentation please take a look here:" > output/README.txt
  337. echo "" >> output/README.txt
  338. echo "https://github.com/drakkan/sftpgo/blob/${{ steps.get_version.outputs.SFTPGO_VERSION }}/README.md" >> output/README.txt
  339. cp LICENSE output/
  340. cp sftpgo.json output/
  341. cp -r templates output/
  342. cp -r static output/
  343. cp -r openapi output/
  344. cp init/sftpgo.service output/init/
  345. ./sftpgo initprovider
  346. ./sftpgo gen completion bash > output/bash_completion/sftpgo
  347. ./sftpgo gen completion zsh > output/zsh_completion/_sftpgo
  348. ./sftpgo gen man -d output/man/man1
  349. gzip output/man/man1/*
  350. cp sftpgo output/
  351. cp sftpgo.db output/sqlite/
  352. cd output
  353. tar cJvf sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_${{ matrix.tar-arch }}.tar.xz *
  354. cd ..
  355. - name: Upload build artifact for ${{ matrix.arch }}
  356. uses: actions/upload-artifact@v3
  357. with:
  358. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_${{ matrix.tar-arch }}.tar.xz
  359. path: ./output/sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_${{ matrix.tar-arch }}.tar.xz
  360. retention-days: 1
  361. - name: Build Packages
  362. id: build_linux_pkgs
  363. run: |
  364. export NFPM_ARCH=${{ matrix.go-arch }}
  365. cd pkgs
  366. ./build.sh
  367. PKG_VERSION=${SFTPGO_VERSION:1}
  368. echo "pkg-version=${PKG_VERSION}" >> $GITHUB_OUTPUT
  369. env:
  370. SFTPGO_VERSION: ${{ steps.get_version.outputs.SFTPGO_VERSION }}
  371. - name: Upload Deb Package
  372. uses: actions/upload-artifact@v3
  373. with:
  374. name: sftpgo_${{ steps.build_linux_pkgs.outputs.pkg-version }}-1_${{ matrix.deb-arch}}.deb
  375. path: ./pkgs/dist/deb/sftpgo_${{ steps.build_linux_pkgs.outputs.pkg-version }}-1_${{ matrix.deb-arch}}.deb
  376. retention-days: 1
  377. - name: Upload RPM Package
  378. uses: actions/upload-artifact@v3
  379. with:
  380. name: sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-1.${{ matrix.rpm-arch}}.rpm
  381. path: ./pkgs/dist/rpm/sftpgo-${{ steps.build_linux_pkgs.outputs.pkg-version }}-1.${{ matrix.rpm-arch}}.rpm
  382. retention-days: 1
  383. prepare-linux-bundle:
  384. name: Prepare Linux bundle
  385. needs: prepare-linux
  386. runs-on: ubuntu-latest
  387. steps:
  388. - name: Get versions
  389. id: get_version
  390. run: |
  391. echo "SFTPGO_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
  392. shell: bash
  393. - name: Download amd64 artifact
  394. uses: actions/download-artifact@v3
  395. with:
  396. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_x86_64.tar.xz
  397. - name: Download arm64 artifact
  398. uses: actions/download-artifact@v3
  399. with:
  400. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_arm64.tar.xz
  401. - name: Download ppc64le artifact
  402. uses: actions/download-artifact@v3
  403. with:
  404. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_ppc64le.tar.xz
  405. - name: Download armv7 artifact
  406. uses: actions/download-artifact@v3
  407. with:
  408. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_armv7.tar.xz
  409. - name: Build bundle
  410. shell: bash
  411. run: |
  412. mkdir -p bundle/{arm64,ppc64le,armv7}
  413. cd bundle
  414. tar xvf ../sftpgo_${SFTPGO_VERSION}_linux_x86_64.tar.xz
  415. cd arm64
  416. tar xvf ../../sftpgo_${SFTPGO_VERSION}_linux_arm64.tar.xz sftpgo
  417. cd ../ppc64le
  418. tar xvf ../../sftpgo_${SFTPGO_VERSION}_linux_ppc64le.tar.xz sftpgo
  419. cd ../armv7
  420. tar xvf ../../sftpgo_${SFTPGO_VERSION}_linux_armv7.tar.xz sftpgo
  421. cd ..
  422. tar cJvf sftpgo_${SFTPGO_VERSION}_linux_bundle.tar.xz *
  423. cd ..
  424. env:
  425. SFTPGO_VERSION: ${{ steps.get_version.outputs.SFTPGO_VERSION }}
  426. - name: Upload Linux bundle
  427. uses: actions/upload-artifact@v3
  428. with:
  429. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_bundle.tar.xz
  430. path: ./bundle/sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_bundle.tar.xz
  431. retention-days: 1
  432. create-release:
  433. name: Release
  434. needs: [prepare-linux-bundle, prepare-sources-with-deps, prepare-window-mac]
  435. runs-on: ubuntu-latest
  436. steps:
  437. - uses: actions/checkout@v4
  438. - name: Get versions
  439. id: get_version
  440. run: |
  441. SFTPGO_VERSION=${GITHUB_REF/refs\/tags\//}
  442. PKG_VERSION=${SFTPGO_VERSION:1}
  443. echo "SFTPGO_VERSION=${SFTPGO_VERSION}" >> $GITHUB_OUTPUT
  444. echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_OUTPUT
  445. shell: bash
  446. - name: Download amd64 artifact
  447. uses: actions/download-artifact@v3
  448. with:
  449. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_x86_64.tar.xz
  450. - name: Download arm64 artifact
  451. uses: actions/download-artifact@v3
  452. with:
  453. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_arm64.tar.xz
  454. - name: Download ppc64le artifact
  455. uses: actions/download-artifact@v3
  456. with:
  457. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_ppc64le.tar.xz
  458. - name: Download armv7 artifact
  459. uses: actions/download-artifact@v3
  460. with:
  461. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_armv7.tar.xz
  462. - name: Download Linux bundle artifact
  463. uses: actions/download-artifact@v3
  464. with:
  465. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_linux_bundle.tar.xz
  466. - name: Download Deb amd64 artifact
  467. uses: actions/download-artifact@v3
  468. with:
  469. name: sftpgo_${{ steps.get_version.outputs.PKG_VERSION }}-1_amd64.deb
  470. - name: Download Deb arm64 artifact
  471. uses: actions/download-artifact@v3
  472. with:
  473. name: sftpgo_${{ steps.get_version.outputs.PKG_VERSION }}-1_arm64.deb
  474. - name: Download Deb ppc64le artifact
  475. uses: actions/download-artifact@v3
  476. with:
  477. name: sftpgo_${{ steps.get_version.outputs.PKG_VERSION }}-1_ppc64el.deb
  478. - name: Download Deb armv7 artifact
  479. uses: actions/download-artifact@v3
  480. with:
  481. name: sftpgo_${{ steps.get_version.outputs.PKG_VERSION }}-1_armhf.deb
  482. - name: Download RPM x86_64 artifact
  483. uses: actions/download-artifact@v3
  484. with:
  485. name: sftpgo-${{ steps.get_version.outputs.PKG_VERSION }}-1.x86_64.rpm
  486. - name: Download RPM aarch64 artifact
  487. uses: actions/download-artifact@v3
  488. with:
  489. name: sftpgo-${{ steps.get_version.outputs.PKG_VERSION }}-1.aarch64.rpm
  490. - name: Download RPM ppc64le artifact
  491. uses: actions/download-artifact@v3
  492. with:
  493. name: sftpgo-${{ steps.get_version.outputs.PKG_VERSION }}-1.ppc64le.rpm
  494. - name: Download RPM armv7 artifact
  495. uses: actions/download-artifact@v3
  496. with:
  497. name: sftpgo-${{ steps.get_version.outputs.PKG_VERSION }}-1.armv7hl.rpm
  498. - name: Download macOS x86_64 artifact
  499. uses: actions/download-artifact@v3
  500. with:
  501. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_macOS_x86_64.tar.xz
  502. - name: Download macOS arm64 artifact
  503. uses: actions/download-artifact@v3
  504. with:
  505. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_macOS_arm64.tar.xz
  506. - name: Download Windows installer x86_64 artifact
  507. uses: actions/download-artifact@v3
  508. with:
  509. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_x86_64.exe
  510. - name: Download Windows installer arm64 artifact
  511. uses: actions/download-artifact@v3
  512. with:
  513. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_arm64.exe
  514. - name: Download Windows installer x86 artifact
  515. uses: actions/download-artifact@v3
  516. with:
  517. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_x86.exe
  518. - name: Download Windows portable artifact
  519. uses: actions/download-artifact@v3
  520. with:
  521. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_portable.zip
  522. - name: Download source with deps artifact
  523. uses: actions/download-artifact@v3
  524. with:
  525. name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_src_with_deps.tar.xz
  526. - name: Create release
  527. run: |
  528. mv sftpgo_windows_x86_64.exe sftpgo_${SFTPGO_VERSION}_windows_x86_64.exe
  529. mv sftpgo_windows_arm64.exe sftpgo_${SFTPGO_VERSION}_windows_arm64.exe
  530. mv sftpgo_windows_x86.exe sftpgo_${SFTPGO_VERSION}_windows_x86.exe
  531. mv sftpgo_portable.zip sftpgo_${SFTPGO_VERSION}_windows_portable.zip
  532. gh release create "${SFTPGO_VERSION}" -t "${SFTPGO_VERSION}"
  533. gh release upload "${SFTPGO_VERSION}" sftpgo_*.xz --clobber
  534. gh release upload "${SFTPGO_VERSION}" sftpgo-*.rpm --clobber
  535. gh release upload "${SFTPGO_VERSION}" sftpgo_*.deb --clobber
  536. gh release upload "${SFTPGO_VERSION}" sftpgo_*.exe --clobber
  537. gh release upload "${SFTPGO_VERSION}" sftpgo_*.zip --clobber
  538. gh release view "${SFTPGO_VERSION}"
  539. env:
  540. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  541. SFTPGO_VERSION: ${{ steps.get_version.outputs.SFTPGO_VERSION }}