autorelease-preview.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Auto release preview @excalidraw/excalidraw-preview
  2. on:
  3. issue_comment:
  4. types: [created, edited]
  5. jobs:
  6. Auto-release-excalidraw-preview:
  7. name: Auto release preview
  8. if: github.event.comment.body == '@excalibot release package' && github.event.issue.pull_request
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: React to release comment
  12. uses: peter-evans/create-or-update-comment@v1
  13. with:
  14. token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
  15. comment-id: ${{ github.event.comment.id }}
  16. reactions: "+1"
  17. - name: Get PR SHA
  18. id: sha
  19. uses: actions/github-script@v4
  20. with:
  21. result-encoding: string
  22. script: |
  23. const { owner, repo, number } = context.issue;
  24. const pr = await github.pulls.get({
  25. owner,
  26. repo,
  27. pull_number: number,
  28. });
  29. return pr.data.head.sha
  30. - uses: actions/checkout@v2
  31. with:
  32. ref: ${{ steps.sha.outputs.result }}
  33. fetch-depth: 2
  34. - name: Setup Node.js 14.x
  35. uses: actions/setup-node@v2
  36. with:
  37. node-version: 14.x
  38. - name: Set up publish access
  39. run: |
  40. npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
  41. env:
  42. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  43. - name: Auto release preview
  44. id: "autorelease"
  45. run: |
  46. yarn add @actions/core
  47. yarn autorelease preview ${{ github.event.issue.number }}
  48. - name: Post comment post release
  49. if: always()
  50. uses: peter-evans/create-or-update-comment@v1
  51. with:
  52. token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }}
  53. issue-number: ${{ github.event.issue.number }}
  54. body: "@${{ github.event.comment.user.login }} ${{ steps.autorelease.outputs.result }}"