stable-windows.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. name: stable-windows
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. force_version:
  6. type: boolean
  7. description: Force update version
  8. generate_assets:
  9. type: boolean
  10. description: Generate assets
  11. checkout_pr:
  12. type: string
  13. description: Checkout PR
  14. repository_dispatch:
  15. types: [stable]
  16. push:
  17. branches: [ master ]
  18. paths-ignore:
  19. - '**/*.md'
  20. pull_request:
  21. branches: [ master ]
  22. paths-ignore:
  23. - '**/*.md'
  24. env:
  25. APP_NAME: VSCodium
  26. ASSETS_REPOSITORY: ${{ github.repository }}
  27. OS_NAME: windows
  28. VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
  29. VSCODE_QUALITY: stable
  30. jobs:
  31. check:
  32. runs-on: ubuntu-latest
  33. outputs:
  34. MS_COMMIT: ${{ env.MS_COMMIT }}
  35. MS_TAG: ${{ env.MS_TAG }}
  36. RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
  37. SHOULD_BUILD: ${{ env.SHOULD_BUILD }}
  38. SHOULD_DEPLOY: ${{ env.SHOULD_DEPLOY }}
  39. steps:
  40. - uses: actions/checkout@v4
  41. with:
  42. ref: ${{ env.GITHUB_BRANCH }}
  43. - name: Switch to relevant branch
  44. env:
  45. PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
  46. run: ./get_pr.sh
  47. - name: Clone VSCode repo
  48. run: ./get_repo.sh
  49. - name: Check PR or cron
  50. env:
  51. GENERATE_ASSETS: ${{ github.event.inputs.generate_assets }}
  52. run: ./check_cron_or_pr.sh
  53. - name: Check existing VSCodium tags/releases
  54. env:
  55. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  56. CHECK_ALL: 'yes'
  57. run: ./check_tags.sh
  58. compile:
  59. needs:
  60. - check
  61. runs-on: ubuntu-20.04
  62. env:
  63. MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
  64. MS_TAG: ${{ needs.check.outputs.MS_TAG }}
  65. RELEASE_VERSION: ${{ needs.check.outputs.RELEASE_VERSION }}
  66. SHOULD_BUILD: ${{ (needs.check.outputs.SHOULD_BUILD == 'yes' || github.event.inputs.generate_assets == 'true') && 'yes' || 'no' }}
  67. VSCODE_ARCH: 'x64'
  68. outputs:
  69. BUILD_SOURCEVERSION: ${{ env.BUILD_SOURCEVERSION }}
  70. steps:
  71. - uses: actions/checkout@v4
  72. with:
  73. ref: ${{ env.GITHUB_BRANCH }}
  74. if: env.SHOULD_BUILD == 'yes'
  75. - name: Switch to relevant branch
  76. env:
  77. PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
  78. run: ./get_pr.sh
  79. - name: Setup GCC
  80. uses: egor-tensin/setup-gcc@v1
  81. with:
  82. version: 10
  83. platform: x64
  84. - name: Setup Node.js environment
  85. uses: actions/setup-node@v4
  86. with:
  87. node-version: '20.18'
  88. if: env.SHOULD_BUILD == 'yes'
  89. - name: Install Yarn
  90. run: npm install -g yarn
  91. if: env.SHOULD_BUILD == 'yes'
  92. - name: Setup Python 3
  93. uses: actions/setup-python@v5
  94. with:
  95. python-version: '3.11'
  96. if: env.SHOULD_BUILD == 'yes'
  97. - name: Install libkrb5-dev
  98. run: sudo apt-get update -y && sudo apt-get install -y libkrb5-dev
  99. if: env.SHOULD_BUILD == 'yes'
  100. - name: Clone VSCode repo
  101. run: ./get_repo.sh
  102. if: env.SHOULD_BUILD == 'yes'
  103. - name: Build
  104. env:
  105. SHOULD_BUILD_REH: 'no'
  106. SHOULD_BUILD_REH_WEB: 'no'
  107. run: ./build.sh
  108. if: env.SHOULD_BUILD == 'yes'
  109. - name: Compress vscode artifact
  110. run: |
  111. find vscode -type f -not -path "*/node_modules/*" -not -path "vscode/.build/node/*" -not -path "vscode/.git/*" > vscode.txt
  112. echo "vscode/.build/extensions/node_modules" >> vscode.txt
  113. echo "vscode/.git" >> vscode.txt
  114. tar -czf vscode.tar.gz -T vscode.txt
  115. if: env.SHOULD_BUILD == 'yes'
  116. - name: Upload vscode artifact
  117. uses: actions/upload-artifact@v4
  118. with:
  119. name: vscode
  120. path: ./vscode.tar.gz
  121. retention-days: ${{ needs.check.outputs.SHOULD_DEPLOY == 'yes' && 30 || 1 }}
  122. if: env.SHOULD_BUILD == 'yes'
  123. build:
  124. needs:
  125. - check
  126. - compile
  127. runs-on: windows-2019
  128. strategy:
  129. fail-fast: false
  130. matrix:
  131. vscode_arch:
  132. - x64
  133. - arm64
  134. defaults:
  135. run:
  136. shell: bash
  137. env:
  138. BUILD_SOURCEVERSION: ${{ needs.compile.outputs.BUILD_SOURCEVERSION }}
  139. MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
  140. MS_TAG: ${{ needs.check.outputs.MS_TAG }}
  141. RELEASE_VERSION: ${{ needs.check.outputs.RELEASE_VERSION }}
  142. SHOULD_BUILD: ${{ (needs.check.outputs.SHOULD_BUILD == 'yes' || github.event.inputs.generate_assets == 'true') && 'yes' || 'no' }}
  143. SHOULD_DEPLOY: ${{ needs.check.outputs.SHOULD_DEPLOY }}
  144. VSCODE_ARCH: ${{ matrix.vscode_arch }}
  145. outputs:
  146. RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
  147. SHOULD_DEPLOY: ${{ env.SHOULD_DEPLOY }}
  148. steps:
  149. - uses: actions/checkout@v4
  150. with:
  151. ref: ${{ env.GITHUB_BRANCH }}
  152. if: env.SHOULD_BUILD == 'yes'
  153. - name: Switch to relevant branch
  154. env:
  155. PULL_REQUEST_ID: ${{ github.event.inputs.checkout_pr }}
  156. run: ./get_pr.sh
  157. if: env.SHOULD_BUILD == 'yes'
  158. - name: Setup Node.js environment
  159. uses: actions/setup-node@v4
  160. with:
  161. node-version: '20.18'
  162. if: env.SHOULD_BUILD == 'yes'
  163. - name: Install Yarn
  164. run: npm install -g yarn
  165. if: env.SHOULD_BUILD == 'yes'
  166. - name: Setup Python 3
  167. uses: actions/setup-python@v5
  168. with:
  169. python-version: '3.11'
  170. if: env.SHOULD_BUILD == 'yes'
  171. - name: Check existing VSCodium tags/releases
  172. env:
  173. DISABLE_MSI: ${{ vars.DISABLE_STABLE_MSI }}
  174. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  175. run: ./check_tags.sh
  176. if: env.SHOULD_BUILD == 'yes'
  177. - name: Download vscode artifact
  178. uses: actions/download-artifact@v4
  179. with:
  180. name: vscode
  181. if: env.SHOULD_BUILD == 'yes'
  182. - name: Build
  183. env:
  184. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  185. npm_config_arch: ${{ matrix.vscode_arch }}
  186. npm_config_target_arch: ${{ matrix.vscode_arch }}
  187. run: ./build/windows/package.sh
  188. if: env.SHOULD_BUILD == 'yes'
  189. - name: Prepare assets
  190. run: ./prepare_assets.sh
  191. if: env.SHOULD_BUILD == 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  192. - name: Upload unsigned artifacts
  193. id: upload-unsigned-artifacts
  194. uses: actions/upload-artifact@v4
  195. with:
  196. name: unsigned-${{ matrix.vscode_arch }}
  197. path: |
  198. assets/*.exe
  199. assets/*.msi
  200. retention-days: 1
  201. if: env.SHOULD_BUILD == 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  202. - name: Signing
  203. uses: signpath/github-action-submit-signing-request@v1
  204. with:
  205. api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
  206. organization-id: ${{ secrets.SIGNPATH_ORGANIZATION_ID }}
  207. project-slug: ${{ secrets.SIGNPATH_PROJECT_SLUG }}
  208. signing-policy-slug: ${{ secrets.SIGNPATH_POLICY_SLUG }}
  209. github-artifact-id: ${{ steps.upload-unsigned-artifacts.outputs.artifact-id }}
  210. artifact-configuration-slug: ${{ matrix.vscode_arch }}
  211. wait-for-completion: true
  212. # 3h to manually approve the request
  213. wait-for-completion-timeout-in-seconds: 10800
  214. output-artifact-directory: assets/
  215. if: env.SHOULD_BUILD == 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  216. - name: Prepare checksums
  217. run: ./prepare_checksums.sh
  218. if: env.SHOULD_BUILD == 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  219. - name: Release
  220. env:
  221. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  222. run: ./release.sh
  223. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  224. - name: Update versions repo
  225. env:
  226. FORCE_UPDATE: ${{ github.event.inputs.force_version }}
  227. GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
  228. GITHUB_USERNAME: ${{ github.repository_owner }}
  229. run: ./update_version.sh
  230. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  231. - name: Upload assets
  232. uses: actions/upload-artifact@v4
  233. with:
  234. name: bin-${{ matrix.vscode_arch }}
  235. path: assets/
  236. retention-days: 3
  237. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'no' && github.event.inputs.generate_assets == 'true'
  238. winget:
  239. needs: build
  240. runs-on: windows-latest
  241. defaults:
  242. run:
  243. shell: bash
  244. env:
  245. APP_IDENTIFIER: VSCodium.VSCodium
  246. if: needs.build.outputs.SHOULD_DEPLOY == 'yes'
  247. steps:
  248. - uses: actions/checkout@v4
  249. with:
  250. ref: ${{ env.GITHUB_BRANCH }}
  251. - name: Check version
  252. run: ./stores/winget/check_version.sh
  253. env:
  254. RELEASE_VERSION: ${{ needs.build.outputs.RELEASE_VERSION }}
  255. - name: Release to WinGet
  256. uses: vedantmgoyal9/winget-releaser@main
  257. with:
  258. identifier: ${{ env.APP_IDENTIFIER }}
  259. version: ${{ env.RELEASE_VERSION }}
  260. release-tag: ${{ env.RELEASE_VERSION }}
  261. installers-regex: '\.exe$' # only .exe files
  262. token: ${{ secrets.STRONGER_GITHUB_TOKEN }}
  263. if: env.SHOULD_DEPLOY == 'yes'