macos.yml 3.9 KB

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