75 řádky
2.8 KiB

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