stable-windows.yml 9.2 KB

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