macos.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. name: macos_build
  2. on:
  3. workflow_dispatch:
  4. schedule:
  5. - cron: '0 0 * * *'
  6. push:
  7. pull_request:
  8. branches: [ master ]
  9. jobs:
  10. build:
  11. runs-on: macOS-latest
  12. env:
  13. OS_NAME: "osx"
  14. VSCODE_ARCH: "x64"
  15. steps:
  16. - uses: actions/checkout@v2
  17. - name: Setup Node.js environment
  18. uses: actions/setup-node@v1
  19. with:
  20. node-version: 14
  21. - name: Check PR or cron
  22. run: |
  23. . check_cron_or_pr.sh
  24. - name: Clone VSCode repo
  25. run: |
  26. . get_repo.sh
  27. - name: Check existing VSCodium tags/releases
  28. env:
  29. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  30. run: |
  31. . check_tags.sh
  32. if: env.SHOULD_DEPLOY == 'yes'
  33. - name: Compute cache key
  34. id: yarnCacheKey
  35. run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
  36. if: env.SHOULD_BUILD == 'yes'
  37. - name: Get yarn cache directory path
  38. id: yarnCacheDirPath
  39. run: echo "::set-output name=dir::$(yarn cache dir)"
  40. if: env.SHOULD_BUILD == 'yes'
  41. - name: Cache yarn directory
  42. uses: actions/cache@v2
  43. with:
  44. path: ${{ steps.yarnCacheDirPath.outputs.dir }}
  45. key: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
  46. restore-keys: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-
  47. if: env.SHOULD_BUILD == 'yes'
  48. - name: Build
  49. env:
  50. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  51. run: ./build.sh
  52. if: env.SHOULD_BUILD == 'yes'
  53. - name: Sign binary
  54. env:
  55. CERTIFICATE_OSX_P12: ${{ secrets.CERTIFICATE_OSX_P12 }}
  56. CERTIFICATE_OSX_PASSWORD: ${{ secrets.CERTIFICATE_OSX_PASSWORD }}
  57. CERTIFICATE_OSX_ID: ${{ secrets.CERTIFICATE_OSX_ID }}
  58. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  59. run: |
  60. if [ -d "VSCode-darwin-${VSCODE_ARCH}" ]; then # just in case the build failed
  61. cd "VSCode-darwin-${VSCODE_ARCH}"
  62. export CERTIFICATE_P12=VSCodium.p12
  63. echo $CERTIFICATE_OSX_P12 | base64 --decode > $CERTIFICATE_P12
  64. export KEYCHAIN=build.keychain
  65. security create-keychain -p mysecretpassword $KEYCHAIN
  66. security default-keychain -s $KEYCHAIN
  67. security unlock-keychain -p mysecretpassword $KEYCHAIN
  68. security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERTIFICATE_OSX_PASSWORD -T /usr/bin/codesign
  69. security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword $KEYCHAIN
  70. codesign --deep --force --verbose --sign "$CERTIFICATE_OSX_ID" VSCodium.app
  71. fi
  72. - name: Zip release
  73. run: |
  74. cd "VSCode-darwin-${VSCODE_ARCH}"
  75. zip -r -X -y ../VSCodium-darwin-${VSCODE_ARCH}-${MS_TAG}.zip ./*.app
  76. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  77. - name: DMG the release
  78. run: |
  79. pushd "VSCode-darwin-${VSCODE_ARCH}"
  80. npx create-dmg VSCodium.app ..
  81. mv "../VSCodium ${MS_TAG}.dmg" "../VSCodium.${VSCODE_ARCH}.${MS_TAG}.dmg"
  82. popd
  83. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  84. - name: Generate shasums
  85. run: ./sum.sh
  86. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  87. - name: Release
  88. uses: softprops/action-gh-release@v1
  89. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  90. with:
  91. tag_name: ${{ env.MS_TAG }}
  92. files: |
  93. ./*.zip
  94. ./*.dmg
  95. ./*.sha256
  96. env:
  97. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  98. - name: Update versions repo
  99. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  100. run: ./update_version.sh
  101. env:
  102. GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
  103. GITHUB_USERNAME: ${{ github.repository_owner }}