insider-windows.yml 9.6 KB

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