desktop-release.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. name: Desktop App Release
  2. on:
  3. push:
  4. branches: [ main ]
  5. paths:
  6. - 'src/main/resources/static/**' # Trigger on frontend changes
  7. - 'desktop-app/**' # Trigger on desktop app changes
  8. - '.github/workflows/desktop-release.yml' # Trigger on workflow changes
  9. env:
  10. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  11. jobs:
  12. create-release:
  13. name: Create Release
  14. runs-on: ubuntu-latest
  15. outputs:
  16. release-id: ${{ steps.create-release.outputs.id }}
  17. release-tag: ${{ steps.create-release.outputs.tag_name }}
  18. release-upload-url: ${{ steps.create-release.outputs.upload_url }}
  19. steps:
  20. - uses: actions/checkout@v4
  21. - name: Get version from package.json
  22. id: get-version
  23. run: |
  24. VERSION=$(node -p "require('./desktop-app/package.json').version")
  25. TIMESTAMP=$(date +%Y%m%d-%H%M%S)
  26. TAG="v${VERSION}-${TIMESTAMP}"
  27. echo "version=${VERSION}" >> $GITHUB_OUTPUT
  28. echo "tag=${TAG}" >> $GITHUB_OUTPUT
  29. - name: Create Release
  30. id: create-release
  31. uses: actions/create-release@v1
  32. env:
  33. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  34. with:
  35. tag_name: ${{ steps.get-version.outputs.tag }}
  36. release_name: kNotes Desktop v${{ steps.get-version.outputs.version }}
  37. body: |
  38. ## kNotes Desktop App - Automatic Release
  39. This release was automatically generated when frontend changes were detected.
  40. ### What's New:
  41. - Latest frontend updates from the web application
  42. - Automatic synchronization with deployed API
  43. - Bug fixes and improvements
  44. ### Downloads:
  45. - **Windows**: Download the `.exe` installer
  46. - **macOS**: Download the `.dmg` installer
  47. - **Linux**: Download the `.AppImage` file
  48. ### Installation:
  49. 1. Download the appropriate file for your operating system
  50. 2. Install/run the application
  51. 3. The app will automatically check for future updates
  52. Built from commit: ${{ github.sha }}
  53. draft: false
  54. prerelease: false
  55. build-linux:
  56. name: Build Linux
  57. needs: create-release
  58. runs-on: ubuntu-latest
  59. steps:
  60. - uses: actions/checkout@v4
  61. - name: Setup Node.js
  62. uses: actions/setup-node@v4
  63. with:
  64. node-version: '18'
  65. cache: 'npm'
  66. cache-dependency-path: desktop-app/package-lock.json
  67. - name: Copy frontend files
  68. run: |
  69. cp -r src/main/resources/static/* desktop-app/
  70. - name: Install dependencies
  71. run: |
  72. cd desktop-app
  73. npm ci
  74. - name: Build and publish Linux
  75. env:
  76. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  77. run: |
  78. cd desktop-app
  79. npm run publish-linux
  80. build-windows:
  81. name: Build Windows
  82. needs: create-release
  83. runs-on: windows-latest
  84. steps:
  85. - uses: actions/checkout@v4
  86. - name: Setup Node.js
  87. uses: actions/setup-node@v4
  88. with:
  89. node-version: '18'
  90. cache: 'npm'
  91. cache-dependency-path: desktop-app/package-lock.json
  92. - name: Copy frontend files
  93. run: |
  94. xcopy "src\main\resources\static\*" "desktop-app\" /E /I /Y
  95. - name: Install dependencies
  96. run: |
  97. cd desktop-app
  98. npm ci
  99. - name: Build and publish Windows
  100. env:
  101. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  102. run: |
  103. cd desktop-app
  104. npm run publish-win
  105. build-macos:
  106. name: Build macOS
  107. needs: create-release
  108. runs-on: macos-latest
  109. steps:
  110. - uses: actions/checkout@v4
  111. - name: Setup Node.js
  112. uses: actions/setup-node@v4
  113. with:
  114. node-version: '18'
  115. cache: 'npm'
  116. cache-dependency-path: desktop-app/package-lock.json
  117. - name: Copy frontend files
  118. run: |
  119. cp -r src/main/resources/static/* desktop-app/
  120. - name: Install dependencies
  121. run: |
  122. cd desktop-app
  123. npm ci
  124. - name: Build and publish macOS
  125. env:
  126. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  127. run: |
  128. cd desktop-app
  129. npm run publish-mac