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.

75 lines
2.8 KiB

  1. name: Publish pre-release
  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/pre >/dev/null 2>&1; then
  24. preRef=$(git show-ref -s origin/pre)
  25. headRef=$(git show-ref --head -s head)
  26. echo "origin/pre"
  27. echo $preRef
  28. echo "HEAD"
  29. echo $headRef
  30. if [ "$preRef" = "$headRef" ]; then
  31. echo "No changes since last pre-release build. Exiting."
  32. echo "status=unchanged" >> $GITHUB_OUTPUT
  33. exit 0
  34. else
  35. echo "Updating pre"
  36. git push origin --delete pre
  37. git checkout -b pre
  38. git push origin pre
  39. fi
  40. else
  41. echo "No pre branch. Creating."
  42. git checkout -b pre
  43. git push origin pre
  44. fi
  45. echo "status=changed" >> $GITHUB_OUTPUT
  46. publish:
  47. name: Publish pre-release
  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: '18'
  58. - name: Install
  59. run: yarn
  60. - name: Apply pre-release patch
  61. run: yarn run patch-pre
  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 --pre-release
  66. - name: Publish extension
  67. run: yarn vsce publish --yarn --pre-release --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