release.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. publish:
  40. needs: [release]
  41. strategy:
  42. matrix:
  43. os: [macos-latest, ubuntu-latest, windows-latest]
  44. runs-on: ${{ matrix.os }}
  45. steps:
  46. - uses: actions/checkout@v2
  47. with:
  48. submodules: true
  49. - uses: conda-incubator/setup-miniconda@v2
  50. with:
  51. auto-update-conda: true
  52. python-version: '3.7'
  53. - name: Install main
  54. shell: bash -l {0}
  55. run: |
  56. pip install .
  57. - name: Run pyinstaller
  58. shell: bash -l {0}
  59. run: |
  60. pip install pyinstaller
  61. pyinstaller labelme.spec
  62. - name: Load release url file from release job
  63. uses: actions/download-artifact@v1
  64. with:
  65. name: release_url
  66. - name: Get release file name & upload url
  67. id: get_release_info
  68. run: |
  69. echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
  70. - name: Upload release executable on macOS & Linux
  71. id: upload_release_executable_macos_linux
  72. uses: actions/upload-release-asset@v1
  73. env:
  74. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  75. with:
  76. upload_url: ${{ steps.get_release_info.outputs.upload_url }}
  77. asset_path: ./dist/labelme
  78. asset_name: labelme-${{ runner.os }}
  79. asset_content_type: application/octet-stream
  80. if: runner.os != 'Windows'
  81. - name: Upload release executable on Windows
  82. id: upload_release_executable_windows
  83. uses: actions/upload-release-asset@v1
  84. env:
  85. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  86. with:
  87. upload_url: ${{ steps.get_release_info.outputs.upload_url }}
  88. asset_path: ./dist/labelme.exe
  89. asset_name: Labelme.exe
  90. asset_content_type: application/octet-stream
  91. if: runner.os == 'Windows'
  92. - name: Create dmg for macOS
  93. run: |
  94. npm install -g create-dmg
  95. cd dist
  96. create-dmg Labelme.app || test -f Labelme\ 0.0.0.dmg
  97. mv Labelme\ 0.0.0.dmg Labelme.dmg
  98. if: runner.os == 'macOS'
  99. - name: Upload release app on macOS
  100. id: upload_release_app_macos
  101. uses: actions/upload-release-asset@v1
  102. env:
  103. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  104. with:
  105. upload_url: ${{ steps.get_release_info.outputs.upload_url }}
  106. asset_path: ./dist/Labelme.dmg
  107. asset_name: Labelme.dmg
  108. asset_content_type: application/octet-stream
  109. if: runner.os == 'macOS'