buildAndRelease.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. name: Release
  2. on:
  3. push:
  4. branches: [ main ]
  5. env:
  6. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  7. jobs:
  8. build-and-test:
  9. name: Build and Test
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v3
  13. - name: Set up JDK
  14. uses: actions/setup-java@v3
  15. with:
  16. java-version: '25'
  17. distribution: 'temurin'
  18. - name: Build with Gradle
  19. run: chmod +x ./gradlew && ./gradlew clean build test
  20. dockerize:
  21. name: Dockerize Application
  22. needs: build-and-test
  23. runs-on: ubuntu-latest
  24. steps:
  25. - uses: actions/checkout@v3
  26. - name: Set up JDK
  27. uses: actions/setup-java@v3
  28. with:
  29. java-version: '25'
  30. distribution: 'temurin'
  31. - name: Build
  32. run: chmod +x ./gradlew && ./gradlew build
  33. - name: Set up Docker Buildx
  34. uses: docker/setup-buildx-action@v2
  35. - name: Login to Docker Hub
  36. uses: docker/login-action@v2
  37. with:
  38. username: ${{ secrets.DOCKERHUB_USERNAME }}
  39. password: ${{ secrets.DOCKERHUB_TOKEN }}
  40. - name: Build and Push Image
  41. run: |
  42. docker buildx create --use
  43. docker buildx build --platform linux/amd64,linux/arm64 -t lhamacorp/knotes:latest --push .
  44. create-desktop-release:
  45. name: Create Desktop Release
  46. needs: dockerize
  47. runs-on: ubuntu-latest
  48. outputs:
  49. release-id: ${{ steps.create-release.outputs.id }}
  50. release-tag: ${{ steps.create-release.outputs.tag_name }}
  51. release-upload-url: ${{ steps.create-release.outputs.upload_url }}
  52. steps:
  53. - uses: actions/checkout@v4
  54. - name: Get version from package.json
  55. id: get-version
  56. run: |
  57. VERSION=$(node -p "require('./desktop-app/package.json').version")
  58. TIMESTAMP=$(date +%Y%m%d-%H%M%S)
  59. TAG="v${VERSION}-${TIMESTAMP}"
  60. echo "version=${VERSION}" >> $GITHUB_OUTPUT
  61. echo "tag=${TAG}" >> $GITHUB_OUTPUT
  62. - name: Create Desktop App Release
  63. id: create-release
  64. uses: actions/create-release@v1
  65. env:
  66. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  67. with:
  68. tag_name: ${{ steps.get-version.outputs.tag }}
  69. release_name: kNotes Desktop v${{ steps.get-version.outputs.version }}
  70. body: |
  71. ## 🚀 kNotes Release - Docker + Desktop Apps
  72. This release includes both the deployed web application and desktop apps for all platforms.
  73. ### 🐳 Docker Deployment:
  74. - **Image**: `lhamacorp/knotes:latest`
  75. - **Platforms**: linux/amd64, linux/arm64
  76. - **Deployed to**: https://notes.lhamacorp.com
  77. ### 📱 Desktop Apps:
  78. - **Windows**: Download the `.exe` installer
  79. - **macOS**: Download the `.dmg` installer
  80. - **Linux**: Download the `.AppImage` file
  81. ### ✨ What's New:
  82. - Latest frontend updates from the web application
  83. - Automatic synchronization with deployed API
  84. - Bug fixes and improvements
  85. - Auto-update functionality for desktop apps
  86. ### 📦 Installation:
  87. 1. Download the appropriate desktop app for your operating system
  88. 2. Install/run the application
  89. 3. The app connects to the deployed API and will check for future updates automatically
  90. **Built from commit**: ${{ github.sha }}
  91. **Docker image**: `docker pull lhamacorp/knotes:latest`
  92. draft: false
  93. prerelease: false
  94. build-linux-desktop:
  95. name: Build Linux Desktop
  96. needs: create-desktop-release
  97. runs-on: ubuntu-latest
  98. steps:
  99. - uses: actions/checkout@v4
  100. - name: Setup Node.js
  101. uses: actions/setup-node@v4
  102. with:
  103. node-version: '18'
  104. cache: 'npm'
  105. cache-dependency-path: desktop-app/package-lock.json
  106. - name: Copy frontend files
  107. run: |
  108. cp -r src/main/resources/static/* desktop-app/
  109. - name: Install dependencies
  110. run: |
  111. cd desktop-app
  112. npm ci
  113. - name: Build and publish Linux
  114. env:
  115. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  116. run: |
  117. cd desktop-app
  118. npm run publish-linux
  119. build-windows-desktop:
  120. name: Build Windows Desktop
  121. needs: create-desktop-release
  122. runs-on: windows-latest
  123. steps:
  124. - uses: actions/checkout@v4
  125. - name: Setup Node.js
  126. uses: actions/setup-node@v4
  127. with:
  128. node-version: '18'
  129. cache: 'npm'
  130. cache-dependency-path: desktop-app/package-lock.json
  131. - name: Copy frontend files
  132. run: |
  133. xcopy "src\main\resources\static\*" "desktop-app\" /E /I /Y
  134. - name: Install dependencies
  135. run: |
  136. cd desktop-app
  137. npm ci
  138. - name: Build and publish Windows
  139. env:
  140. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  141. run: |
  142. cd desktop-app
  143. npm run publish-win
  144. build-macos-desktop:
  145. name: Build macOS Desktop
  146. needs: create-desktop-release
  147. runs-on: macos-latest
  148. steps:
  149. - uses: actions/checkout@v4
  150. - name: Setup Node.js
  151. uses: actions/setup-node@v4
  152. with:
  153. node-version: '18'
  154. cache: 'npm'
  155. cache-dependency-path: desktop-app/package-lock.json
  156. - name: Copy frontend files
  157. run: |
  158. cp -r src/main/resources/static/* desktop-app/
  159. - name: Install dependencies
  160. run: |
  161. cd desktop-app
  162. npm ci
  163. - name: Build and publish macOS
  164. env:
  165. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  166. run: |
  167. cd desktop-app
  168. npm run publish-mac