feature-release.yml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: Feature Release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. branch:
  6. description: 'Branch to run the action on'
  7. required: true
  8. default: 'unstable'
  9. jobs:
  10. feature-release:
  11. runs-on: ubuntu-latest
  12. environment: prod
  13. steps:
  14. - name: checkout unstable branch
  15. uses: actions/checkout@v3
  16. with:
  17. ref: 'unstable'
  18. fetch-depth: 0
  19. - uses: actions/setup-node@v3
  20. with:
  21. node-version: 22
  22. cache: 'npm'
  23. registry-url: 'https://registry.npmjs.org'
  24. - name: Install dependencies
  25. run: npm install
  26. - name: Install Playwright Browsers
  27. run: npx playwright install --with-deps
  28. - name: Run tests
  29. run : |
  30. npm test
  31. - name: Determine version for the release
  32. id: get_new_patch_version
  33. run: |
  34. pwd
  35. chmod 777 -R ./* ./.[!.]*
  36. . ./.github/workflows/scripts/new-feature-version.sh
  37. shell: bash
  38. - name: See new master version and jq version
  39. run: |
  40. echo VERSION ${{ env.VERSION }}
  41. jq --version
  42. shell: bash
  43. - name: Checkout Master Branch
  44. uses: actions/checkout@v3
  45. with:
  46. ref: master
  47. fetch-depth: 0
  48. - name: Update documentation and Merge unstable to master branch
  49. run: |
  50. . ./.github/workflows/scripts/merge_unstable_to_master.sh
  51. - name: Build release and verify changes
  52. id: release
  53. run: |
  54. . .github/workflows/scripts/pre_release_test.sh master
  55. - name: Archive code coverage results
  56. uses: actions/upload-artifact@v4
  57. if: ${{ failure() && steps.release.conclusion == 'failure' }}
  58. with:
  59. name: npm-release--failure-report
  60. path: /home/runner/.npm/_logs/
  61. - name: Publish Package To npmjs
  62. run: npm publish
  63. env:
  64. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  65. - name: Publish Package to GitHub Releases
  66. run: |
  67. curl -L \
  68. -X POST \
  69. -H "Accept: application/vnd.github+json" \
  70. -H "Authorization: Bearer ${{ secrets.MAIN_GH_TOKEN }}" \
  71. -H "X-GitHub-Api-Version: 2022-11-28" \
  72. https://api.github.com/repos/${{ github.repository }}/releases \
  73. -d '{"tag_name":"v${{ env.VERSION }}","target_commitish":"master","name":"v${{ env.VERSION }}","body":"Release version v${{ env.VERSION }}","draft":false,"prerelease":false,"generate_release_notes":false}'
  74. - name: Deploy to Github Pages 🚀
  75. uses: JamesIves/github-pages-deploy-action@v4
  76. with:
  77. folder: documentation
  78. - name: Create Issue
  79. run: |
  80. TITLE="Create a blog post for release v$VERSION"
  81. echo "Issue title: $TITLE"
  82. sed ':a;N;$!ba;s/\n/\\n/g' ./.github/workflows/md/blog-issue-template.md > output_file.txt
  83. BODY="$(cat output_file.txt)"
  84. echo "Body: $BODY"
  85. curl -X POST \
  86. -H "Authorization: token ${{ secrets.CYTOSCAPE_JS_BLOG_TOKEN }}" \
  87. -H "Accept: application/vnd.github.v3+json" \
  88. "https://api.github.com/repos/cytoscape/cytoscape.js-blog/issues" \
  89. -d "{\"title\":\"$TITLE\",\"body\":\"$BODY\"}"