release.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. name: release
  2. on:
  3. push:
  4. tags:
  5. - 'v*'
  6. jobs:
  7. release:
  8. if: startsWith(github.ref, 'refs/tags/')
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Build Changelog
  12. id: github_release
  13. uses: mikepenz/release-changelog-builder-action@v3
  14. env:
  15. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  16. with:
  17. configurationJson: |
  18. {
  19. "template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>\n\nIf you find this project useful, please consider [sponsoring](https://github.com/sponsors/wkentaro) its development.",
  20. "categories": [
  21. {
  22. "title": "## 🚀 Features",
  23. "labels": ["feature"]
  24. },
  25. {
  26. "title": "## 🐛 Fixes",
  27. "labels": ["fix"]
  28. },
  29. {
  30. "title": "## 💬 Other",
  31. "labels": ["other"]
  32. }
  33. ]
  34. }
  35. - name: Create Release
  36. uses: mikepenz/action-gh-release@v0.2.0-a03
  37. with:
  38. body: ${{steps.github_release.outputs.changelog}}
  39. - name: Create release url file
  40. run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
  41. - name: Save release url file for publish
  42. uses: actions/upload-artifact@v1
  43. with:
  44. name: release_url
  45. path: release_url.txt
  46. publish:
  47. needs: [release]
  48. strategy:
  49. matrix:
  50. os: [macos-latest, ubuntu-latest, windows-latest]
  51. runs-on: ${{ matrix.os }}
  52. steps:
  53. - uses: actions/checkout@v2
  54. with:
  55. submodules: true
  56. - uses: conda-incubator/setup-miniconda@v2
  57. with:
  58. auto-update-conda: true
  59. python-version: '3.7'
  60. - name: Install main
  61. shell: bash -l {0}
  62. run: |
  63. pip install .
  64. - name: Run pyinstaller
  65. shell: bash -l {0}
  66. run: |
  67. pip install pyinstaller
  68. pyinstaller labelme.spec
  69. - name: Load release url file from release job
  70. uses: actions/download-artifact@v1
  71. with:
  72. name: release_url
  73. - name: Get release file name & upload url
  74. id: get_release_info
  75. run: |
  76. echo "upload_url=$(cat release_url/release_url.txt)" >> $GITHUB_STATE
  77. - name: Upload release executable on macOS & Linux
  78. id: upload_release_executable_macos_linux
  79. uses: actions/upload-release-asset@v1
  80. env:
  81. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  82. with:
  83. upload_url: ${{ steps.get_release_info.outputs.upload_url }}
  84. asset_path: ./dist/labelme
  85. asset_name: labelme-${{ runner.os }}
  86. asset_content_type: application/octet-stream
  87. if: runner.os != 'Windows'
  88. - name: Upload release executable on Windows
  89. id: upload_release_executable_windows
  90. uses: actions/upload-release-asset@v1
  91. env:
  92. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  93. with:
  94. upload_url: ${{ steps.get_release_info.outputs.upload_url }}
  95. asset_path: ./dist/labelme.exe
  96. asset_name: Labelme.exe
  97. asset_content_type: application/octet-stream
  98. if: runner.os == 'Windows'
  99. - name: Create dmg for macOS
  100. run: |
  101. npm install -g create-dmg
  102. cd dist
  103. create-dmg Labelme.app || test -f Labelme\ 0.0.0.dmg
  104. mv Labelme\ 0.0.0.dmg Labelme.dmg
  105. if: runner.os == 'macOS'
  106. - name: Upload release app on macOS
  107. id: upload_release_app_macos
  108. uses: actions/upload-release-asset@v1
  109. env:
  110. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  111. with:
  112. upload_url: ${{ steps.get_release_info.outputs.upload_url }}
  113. asset_path: ./dist/Labelme.dmg
  114. asset_name: Labelme.dmg
  115. asset_content_type: application/octet-stream
  116. if: runner.os == 'macOS'