insider-windows.yml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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: 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: Setup Python 3
  166. uses: actions/setup-python@v5
  167. with:
  168. python-version: '3.11'
  169. if: env.SHOULD_BUILD == 'yes'
  170. - name: Check existing VSCodium tags/releases
  171. env:
  172. DISABLE_MSI: ${{ vars.DISABLE_INSIDER_MSI }}
  173. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  174. run: ./check_tags.sh
  175. if: env.SHOULD_BUILD == 'yes'
  176. - name: Download vscode artifact
  177. uses: actions/download-artifact@v4
  178. with:
  179. name: vscode
  180. if: env.SHOULD_BUILD == 'yes'
  181. - name: Build
  182. env:
  183. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  184. npm_config_arch: ${{ matrix.vscode_arch }}
  185. npm_config_target_arch: ${{ matrix.vscode_arch }}
  186. run: ./build/windows/package.sh
  187. if: env.SHOULD_BUILD == 'yes'
  188. - name: Prepare assets
  189. run: ./prepare_assets.sh
  190. if: env.SHOULD_BUILD == 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  191. - name: Upload unsigned artifacts
  192. id: upload-unsigned-artifacts
  193. uses: actions/upload-artifact@v4
  194. with:
  195. name: unsigned-${{ matrix.vscode_arch }}
  196. path: |
  197. assets/*.exe
  198. assets/*.msi
  199. retention-days: 1
  200. if: env.SHOULD_BUILD == 'yes' && vars.DISABLE_INSIDER_WINDOWS_SIGNING != 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  201. - name: Signing
  202. uses: signpath/github-action-submit-signing-request@v1
  203. with:
  204. api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
  205. organization-id: ${{ secrets.SIGNPATH_ORGANIZATION_ID }}
  206. project-slug: ${{ secrets.SIGNPATH_PROJECT_SLUG }}
  207. signing-policy-slug: ${{ secrets.SIGNPATH_POLICY_SLUG }}
  208. github-artifact-id: ${{ steps.upload-unsigned-artifacts.outputs.artifact-id }}
  209. artifact-configuration-slug: ${{ matrix.vscode_arch }}
  210. wait-for-completion: true
  211. # 3h to manually approve the request
  212. wait-for-completion-timeout-in-seconds: 10800
  213. output-artifact-directory: assets/
  214. if: env.SHOULD_BUILD == 'yes' && vars.DISABLE_INSIDER_WINDOWS_SIGNING != 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  215. - name: Prepare checksums
  216. run: ./prepare_checksums.sh
  217. if: env.SHOULD_BUILD == 'yes' && (env.SHOULD_DEPLOY == 'yes' || github.event.inputs.generate_assets == 'true')
  218. - name: Release
  219. env:
  220. GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
  221. GITHUB_USERNAME: ${{ github.repository_owner }}
  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.Insiders
  246. ASSETS_REPOSITORY: vscodium-insiders
  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-repository: ${{ env.ASSETS_REPOSITORY }}
  262. release-tag: ${{ env.RELEASE_VERSION }}-insider
  263. installers-regex: '\.exe$' # only .exe files
  264. token: ${{ secrets.STRONGER_GITHUB_TOKEN }}
  265. if: env.SHOULD_DEPLOY == 'yes'