macos.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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: ${{ matrix.os }}
  12. strategy:
  13. fail-fast: false
  14. matrix:
  15. include:
  16. - vscode_arch: x64
  17. os: macOS-10.15
  18. # - vscode_arch: arm64
  19. # os: macOS-11
  20. env:
  21. OS_NAME: "osx"
  22. VSCODE_ARCH: ${{ matrix.vscode_arch }}
  23. steps:
  24. - uses: actions/checkout@v3
  25. - name: Setup Node.js environment
  26. uses: actions/setup-node@v3
  27. with:
  28. node-version: 16
  29. - name: Clone VSCode repo
  30. run: . get_repo.sh
  31. - name: Check PR or cron
  32. run: . check_cron_or_pr.sh
  33. - name: Check existing VSCodium tags/releases
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. run: . check_tags.sh
  37. if: env.SHOULD_DEPLOY == 'yes'
  38. - name: Compute cache key
  39. id: yarnCacheKey
  40. run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
  41. if: env.SHOULD_BUILD == 'yes'
  42. - name: Get yarn cache directory path
  43. id: yarnCacheDirPath
  44. run: echo "::set-output name=dir::$(yarn cache dir)"
  45. if: env.SHOULD_BUILD == 'yes'
  46. - name: Cache yarn directory
  47. uses: actions/cache@v3
  48. with:
  49. path: ${{ steps.yarnCacheDirPath.outputs.dir }}
  50. key: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
  51. restore-keys: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-
  52. if: env.SHOULD_BUILD == 'yes'
  53. - name: Build
  54. env:
  55. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  56. run: ./build.sh
  57. if: env.SHOULD_BUILD == 'yes'
  58. - name: Sign binary
  59. env:
  60. CERTIFICATE_OSX_P12: ${{ secrets.CERTIFICATE_OSX_P12 }}
  61. CERTIFICATE_OSX_PASSWORD: ${{ secrets.CERTIFICATE_OSX_PASSWORD }}
  62. CERTIFICATE_OSX_ID: ${{ secrets.CERTIFICATE_OSX_ID }}
  63. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  64. run: |
  65. if [ -d "VSCode-darwin-${VSCODE_ARCH}" ]; then # just in case the build failed
  66. cd "VSCode-darwin-${VSCODE_ARCH}"
  67. export CERTIFICATE_P12=VSCodium.p12
  68. echo $CERTIFICATE_OSX_P12 | base64 --decode > $CERTIFICATE_P12
  69. export KEYCHAIN=build.keychain
  70. security create-keychain -p mysecretpassword $KEYCHAIN
  71. security default-keychain -s $KEYCHAIN
  72. security unlock-keychain -p mysecretpassword $KEYCHAIN
  73. security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERTIFICATE_OSX_PASSWORD -T /usr/bin/codesign
  74. security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword $KEYCHAIN
  75. codesign --deep --force --verbose --sign "$CERTIFICATE_OSX_ID" VSCodium.app
  76. fi
  77. - name: Prepare artifacts
  78. run: ./prepare_artifacts.sh
  79. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  80. - name: Release
  81. env:
  82. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  83. run: ./release.sh
  84. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  85. - name: Update versions repo
  86. if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
  87. run: ./update_version.sh
  88. env:
  89. GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
  90. GITHUB_USERNAME: ${{ github.repository_owner }}