stable-windows.yml 9.3 KB

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