You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.8 KiB

  1. name: Publish Insiders
  2. on:
  3. schedule:
  4. - cron: '0 9 * * *' # every day at 4am EST
  5. workflow_dispatch:
  6. jobs:
  7. check:
  8. name: Check for updates
  9. runs-on: ubuntu-latest
  10. outputs:
  11. status: ${{ steps.earlyexit.outputs.status }}
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@v2
  15. with:
  16. fetch-depth: 0
  17. - id: earlyexit
  18. run: |
  19. git config user.name github-actions
  20. git config user.email github-actions@github.com
  21. if git rev-parse origin/insiders >/dev/null 2>&1; then
  22. insidersRef=$(git show-ref -s origin/insiders)
  23. headRef=$(git show-ref --head -s head)
  24. echo "origin/insiders"
  25. echo $insidersRef
  26. echo "HEAD"
  27. echo $headRef
  28. if [ "$insidersRef" = "$headRef" ]; then
  29. echo "No changes since last insiders build. Exiting."
  30. echo "::set-output name=status::unchanged"
  31. exit 0
  32. else
  33. echo "Updating insiders"
  34. git push origin --delete insiders
  35. git checkout -b insiders
  36. git push origin insiders
  37. fi
  38. else
  39. echo "No insiders branch. Creating."
  40. git checkout -b insiders
  41. git push origin insiders
  42. fi
  43. echo "::set-output name=status::changed"
  44. publish:
  45. name: Publish insiders
  46. needs: check
  47. runs-on: ubuntu-latest
  48. if: needs.check.outputs.status == 'changed'
  49. steps:
  50. - name: Checkout code
  51. uses: actions/checkout@v2
  52. - name: Setup node
  53. uses: actions/setup-node@v1
  54. with:
  55. node-version: '12.x'
  56. - name: Install
  57. run: yarn
  58. - name: Apply insiders patch
  59. run: yarn run patch-insiders
  60. - name: Setup Environment
  61. run: node -e "console.log('PACKAGE_VERSION=' + require('./package.json').version + '\nPACKAGE_NAME=' + require('./package.json').name + '-' + require('./package.json').version)" >> $GITHUB_ENV
  62. - name: Package extension
  63. run: yarn run pack
  64. - name: Publish extension
  65. run: yarn vsce publish --yarn --packagePath ./${{ env.PACKAGE_NAME }}.vsix -p ${{ secrets.MARKETPLACE_PAT }}
  66. - name: Publish artifact
  67. uses: actions/upload-artifact@v2
  68. with:
  69. name: ${{ env.PACKAGE_NAME }}.vsix
  70. path: ./${{ env.PACKAGE_NAME }}.vsix