macos.yml 3.9 KB

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