release.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: Release
  2. on:
  3. workflow_dispatch:
  4. branches:
  5. - master
  6. jobs:
  7. build:
  8. runs-on: windows-latest
  9. steps:
  10. - name: Checkout code
  11. uses: actions/checkout@v4
  12. - name: Set up Python
  13. uses: actions/setup-python@v4
  14. with:
  15. python-version: '3.13'
  16. update-environment: true
  17. cache: 'pipenv'
  18. - name: Install pipenv
  19. run: pip3 install --user pipenv
  20. - name: Install dependencies with pipenv
  21. run: pipenv --python 3.13 && pipenv install --dev
  22. - name: Build the application
  23. run: pipenv run pyinstaller tkinter_ui/tkinter_ui.spec
  24. - name: List dist directory contents
  25. run: dir dist
  26. - name: Upload artifact
  27. uses: actions/upload-artifact@v4
  28. with:
  29. name: IPTV
  30. path: dist
  31. - name: Get version from version.json
  32. id: get_info
  33. run: |
  34. $version = (Get-Content version.json | ConvertFrom-Json).version
  35. echo "version=$version" >> $env:GITHUB_ENV
  36. shell: pwsh
  37. - name: Install jq
  38. run: choco install jq
  39. - name: Get changelog
  40. id: get_changelog
  41. run: |
  42. $version = "${{ env.version }}"
  43. $changelog = (Get-Content CHANGELOG.md) -join "`n"
  44. $changelog = $changelog -replace "(?s).*?## v$version", ""
  45. $changelog = $changelog -replace "(?s)## v.*", ""
  46. $changelog = $changelog -replace "(?s).*?###", "###"
  47. $changelog = $changelog.TrimEnd("`n")
  48. $changelog | jq -Rs '.' | ForEach-Object { echo "changelog=$_"; echo "changelog=$_" >> $env:GITHUB_ENV }
  49. shell: pwsh
  50. - name: Create Release
  51. id: create_release
  52. uses: actions/create-release@v1
  53. env:
  54. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  55. with:
  56. tag_name: ${{ env.version }}
  57. release_name: v${{ env.version }}
  58. body: ${{ fromJSON(env.changelog) }}
  59. draft: false
  60. prerelease: false
  61. - name: Upload Release Asset
  62. uses: actions/upload-release-asset@v1
  63. env:
  64. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  65. with:
  66. upload_url: ${{ steps.create_release.outputs.upload_url }}
  67. asset_path: dist/IPTV.exe
  68. asset_name: IPTV.exe
  69. asset_content_type: application/octet-stream