insider-windows.yml 9.8 KB

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