|
1 | | -name: Release |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - tags: |
6 | | - - 'v*' |
7 | | - workflow_dispatch: |
8 | | - inputs: |
9 | | - version: |
10 | | - description: 'Version to release (e.g., 1.3.0)' |
11 | | - required: true |
12 | | - type: string |
13 | | - |
14 | | -env: |
15 | | - NODE_VERSION: '20' |
16 | | - |
17 | | -jobs: |
18 | | - build-and-release: |
19 | | - runs-on: ${{ matrix.os }} |
20 | | - strategy: |
21 | | - matrix: |
22 | | - os: [windows-latest, macos-latest, ubuntu-latest] |
23 | | - include: |
24 | | - - os: windows-latest |
25 | | - platform: win |
26 | | - - os: macos-latest |
27 | | - platform: mac |
28 | | - - os: ubuntu-latest |
29 | | - platform: linux |
30 | | - |
31 | | - steps: |
32 | | - - name: Checkout repository |
33 | | - uses: actions/checkout@v4 |
34 | | - with: |
35 | | - fetch-depth: 0 |
36 | | - |
37 | | - - name: Set up Node.js |
38 | | - uses: actions/setup-node@v4 |
39 | | - with: |
40 | | - node-version: ${{ env.NODE_VERSION }} |
41 | | - cache: 'npm' |
42 | | - |
43 | | - - name: Install system dependencies (Linux) |
44 | | - if: matrix.platform == 'linux' |
45 | | - run: | |
46 | | - sudo apt-get update |
47 | | - sudo apt-get install -y libxtst6 libxrandr2 libasound2-dev libgtk-3-dev libxss1 libgconf-2-4 libxtst6 libxrandr2 libasound2-dev libpangocairo-1.0-0 libatk1.0-0 libcairo-gobject2 libgtk-3-0 libgdk-pixbuf2.0-0 |
48 | | -
|
49 | | - - name: Install system dependencies (macOS) |
50 | | - if: matrix.platform == 'mac' |
51 | | - run: | |
52 | | - echo "macOS dependencies ready" |
53 | | -
|
54 | | - - name: Install dependencies |
55 | | - run: npm ci --ignore-scripts |
56 | | - |
57 | | - - name: Rebuild native modules |
58 | | - run: | |
59 | | - npm rebuild robotjs --build-from-source || echo "RobotJS build failed, continuing without it" |
60 | | - continue-on-error: true |
61 | | - |
62 | | - - name: Run type checking |
63 | | - run: npm run typecheck |
64 | | - |
65 | | - - name: Build application |
66 | | - run: npm run build |
67 | | - |
68 | | - - name: Install app dependencies (Electron) |
69 | | - run: npm run postinstall |
70 | | - |
71 | | - - name: Build Electron app |
72 | | - env: |
73 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
74 | | - CSC_IDENTITY_AUTO_DISCOVERY: false |
75 | | - ROBOTJS_SKIP_OPTIONAL: true |
76 | | - run: | |
77 | | - if [[ "${{ matrix.platform }}" == "win" ]]; then |
78 | | - echo "Building for Windows..." |
79 | | - npm run package:win || (echo "Windows build failed, trying alternative..." && npm run dist) |
80 | | - elif [[ "${{ matrix.platform }}" == "mac" ]]; then |
81 | | - echo "Building for macOS..." |
82 | | - npm run package:mac || (echo "macOS build failed, trying alternative..." && npm run dist) |
83 | | - elif [[ "${{ matrix.platform }}" == "linux" ]]; then |
84 | | - echo "Building for Linux..." |
85 | | - npm run package:linux || (echo "Linux build failed, trying alternative..." && npm run dist) |
86 | | - fi |
87 | | - shell: bash |
88 | | - |
89 | | - - name: List build outputs |
90 | | - run: | |
91 | | - echo "Contents of dist-electron (if exists):" |
92 | | - ls -la dist-electron/ 2>/dev/null || echo "No dist-electron directory found" |
93 | | - echo "Contents of dist (if exists):" |
94 | | - ls -la dist/ 2>/dev/null || echo "No dist directory found" |
95 | | - echo "Looking for any build artifacts:" |
96 | | - find . -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.deb" 2>/dev/null || echo "No build artifacts found" |
97 | | - shell: bash |
98 | | - |
99 | | - - name: Upload artifacts |
100 | | - uses: actions/upload-artifact@v4 |
101 | | - if: always() |
102 | | - with: |
103 | | - name: release-${{ matrix.platform }} |
104 | | - path: | |
105 | | - dist-electron/*.exe |
106 | | - dist-electron/*.dmg |
107 | | - dist-electron/*.AppImage |
108 | | - dist-electron/*.deb |
109 | | - dist/*.exe |
110 | | - dist/*.dmg |
111 | | - dist/*.AppImage |
112 | | - dist/*.deb |
113 | | - release/*.exe |
114 | | - release/*.dmg |
115 | | - release/*.AppImage |
116 | | - release/*.deb |
117 | | - retention-days: 5 |
118 | | - if-no-files-found: warn |
119 | | - |
120 | | - create-release: |
121 | | - needs: build-and-release |
122 | | - runs-on: ubuntu-latest |
123 | | - if: startsWith(github.ref, 'refs/tags/') |
124 | | - |
125 | | - steps: |
126 | | - - name: Checkout repository |
127 | | - uses: actions/checkout@v4 |
128 | | - |
129 | | - - name: Download all artifacts |
130 | | - uses: actions/download-artifact@v4 |
131 | | - with: |
132 | | - path: ./artifacts |
133 | | - |
134 | | - - name: Get version from tag |
135 | | - id: version |
136 | | - run: | |
137 | | - TAG_NAME=${GITHUB_REF#refs/tags/} |
138 | | - VERSION=${TAG_NAME#v} |
139 | | - echo "version=$VERSION" >> $GITHUB_OUTPUT |
140 | | - echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT |
141 | | -
|
142 | | - - name: Create GitHub Release |
143 | | - uses: softprops/action-gh-release@v2 |
144 | | - with: |
145 | | - tag_name: ${{ steps.version.outputs.tag }} |
146 | | - name: New World Chat AI ${{ steps.version.outputs.version }} |
147 | | - files: | |
148 | | - ./artifacts/**/*.exe |
149 | | - ./artifacts/**/*.dmg |
150 | | - ./artifacts/**/*.AppImage |
151 | | - ./artifacts/**/*.deb |
152 | | - draft: false |
153 | | - prerelease: false |
154 | | - env: |
155 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments