|
1 | 1 | name: Release - Build and Publish |
2 | 2 |
|
3 | 3 | on: |
4 | | - release: |
5 | | - types: [created] |
| 4 | + release: |
| 5 | + types: [created] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - build-windows: |
9 | | - name: Build Windows Executable |
10 | | - runs-on: windows-latest |
11 | | - |
12 | | - steps: |
13 | | - - name: Checkout code |
14 | | - uses: actions/checkout@v4 |
15 | | - |
16 | | - - name: Set up Python |
17 | | - uses: actions/setup-python@v5 |
18 | | - with: |
19 | | - python-version: "3.13" |
20 | | - |
21 | | - - name: Install UV |
22 | | - uses: astral-sh/setup-uv@v4 |
23 | | - |
24 | | - - name: Install dependencies |
25 | | - run: uv sync |
26 | | - |
27 | | - - name: Install PyInstaller |
28 | | - run: uv pip install pyinstaller>=6.0.0 |
29 | | - |
30 | | - - name: Extract version from tag |
31 | | - id: get_version |
32 | | - shell: pwsh |
33 | | - run: | |
34 | | - $version = "${{ github.ref_name }}" -replace '^v', '' |
35 | | - echo "VERSION=$version" >> $env:GITHUB_OUTPUT |
36 | | - echo "Building version: $version" |
37 | | -
|
38 | | - - name: Update version in pyproject.toml |
39 | | - shell: pwsh |
40 | | - run: | |
41 | | - $version = "${{ steps.get_version.outputs.VERSION }}" |
42 | | - $content = Get-Content pyproject.toml -Raw |
43 | | - $content = $content -replace 'version = "[^"]+"', "version = `"$version`"" |
44 | | - Set-Content pyproject.toml $content |
45 | | -
|
46 | | - - name: Build executable with PyInstaller |
47 | | - run: uv run pyinstaller mechbay.spec --clean |
48 | | - |
49 | | - - name: Create distribution folder |
50 | | - shell: pwsh |
51 | | - run: | |
52 | | - $version = "${{ steps.get_version.outputs.VERSION }}" |
53 | | - $distFolder = "dist/MechBay_v$version" |
54 | | -
|
55 | | - # Create folder and copy files |
56 | | - New-Item -ItemType Directory -Path $distFolder -Force | Out-Null |
57 | | - Copy-Item -Recurse "dist/MechBay/*" $distFolder |
58 | | - Copy-Item ".env.example" "$distFolder/.env.example" |
59 | | -
|
60 | | - # Generate README.txt (use PowerShell here-string in script) |
61 | | - $readme = "MechBay v$version`n" + |
62 | | - "================`n`n" + |
63 | | - "GETTING STARTED`n" + |
64 | | - "---------------`n" + |
65 | | - "1. Double-click MechBay.exe to start the application`n" + |
66 | | - "2. Your web browser will automatically open to http://127.0.0.1:5001`n" + |
67 | | - "3. The application runs locally on your computer (no internet required)`n" + |
68 | | - "4. Close the terminal window to stop the server`n`n" + |
69 | | - "DATABASE LOCATION`n" + |
70 | | - "-----------------`n" + |
71 | | - "Your miniature inventory is stored in:`n" + |
72 | | - " %APPDATA%\MechBay\mechbay.db`n`n" + |
73 | | - "This is typically located at:`n" + |
74 | | - " C:\Users\<YourUsername>\AppData\Roaming\MechBay\mechbay.db`n`n" + |
75 | | - "BACKING UP YOUR DATA`n" + |
76 | | - "--------------------`n" + |
77 | | - "Method 1 - Direct Database Backup (Recommended):`n" + |
78 | | - " 1. Close MechBay if it's running`n" + |
79 | | - " 2. Copy the mechbay.db file from %APPDATA%\MechBay\ to a safe location`n" + |
80 | | - " 3. To restore, copy the backup file back to %APPDATA%\MechBay\`n`n" + |
81 | | - "Method 2 - JSON Export/Import:`n" + |
82 | | - " 1. In the web interface, go to Miniatures, Forces, or Lance Templates`n" + |
83 | | - " 2. Click 'Export JSON' to download your data`n" + |
84 | | - " 3. Save the JSON file in a safe location`n" + |
85 | | - " 4. To restore, use the 'Import JSON' feature`n`n" + |
86 | | - "UPDATING TO A NEW VERSION`n" + |
87 | | - "--------------------------`n" + |
88 | | - "1. Backup your database (see above)`n" + |
89 | | - "2. Download the new version`n" + |
90 | | - "3. Extract and run - your data in %APPDATA% will be preserved`n" + |
91 | | - "4. If you encounter issues, restore from your backup`n`n" + |
92 | | - "TROUBLESHOOTING`n" + |
93 | | - "---------------`n" + |
94 | | - "- If the browser doesn't open automatically, navigate to http://127.0.0.1:5001`n" + |
95 | | - "- If port 5001 is already in use, close other applications`n" + |
96 | | - "- For issues, check the terminal window for error messages`n" + |
97 | | - "- Visit https://github.com/cantis/MechBay for support`n`n" + |
98 | | - "CONFIGURATION (Advanced)`n" + |
99 | | - "------------------------`n" + |
100 | | - "Create a .env file in the same folder as MechBay.exe to customize settings.`n" + |
101 | | - "See .env.example for available options." |
102 | | -
|
103 | | - Set-Content -Path "$distFolder/README.txt" -Value $readme |
104 | | -
|
105 | | - - name: Create ZIP archive |
106 | | - shell: pwsh |
107 | | - run: | |
108 | | - $version = "${{ steps.get_version.outputs.VERSION }}" |
109 | | - $distFolder = "dist/MechBay_v$version" |
110 | | - $zipFile = "MechBay_v$version-windows.zip" |
111 | | -
|
112 | | - Compress-Archive -Path $distFolder -DestinationPath $zipFile |
113 | | - echo "ZIP_FILE=$zipFile" >> $env:GITHUB_OUTPUT |
114 | | - id: create_zip |
115 | | - |
116 | | - - name: Upload release asset |
117 | | - uses: softprops/action-gh-release@v1 |
118 | | - with: |
119 | | - files: MechBay_v${{ steps.get_version.outputs.VERSION }}-windows.zip |
120 | | - token: ${{ secrets.GITHUB_TOKEN }} |
121 | | - |
122 | | - - name: Upload build artifacts |
123 | | - uses: actions/upload-artifact@v4 |
124 | | - with: |
125 | | - name: mechbay-windows-${{ steps.get_version.outputs.VERSION }} |
126 | | - path: dist/MechBay_v${{ steps.get_version.outputs.VERSION }}/ |
127 | | - retention-days: 30 |
| 8 | + build-windows: |
| 9 | + name: Build Windows Executable |
| 10 | + runs-on: windows-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: "3.13" |
| 20 | + |
| 21 | + - name: Install UV |
| 22 | + uses: astral-sh/setup-uv@v4 |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: uv sync |
| 26 | + |
| 27 | + - name: Install PyInstaller |
| 28 | + run: uv pip install pyinstaller>=6.0.0 |
| 29 | + |
| 30 | + - name: Extract version from tag |
| 31 | + id: get_version |
| 32 | + shell: pwsh |
| 33 | + run: | |
| 34 | + $version = "${{ github.ref_name }}" -replace '^v', '' |
| 35 | + echo "VERSION=$version" >> $env:GITHUB_OUTPUT |
| 36 | + echo "Building version: $version" |
| 37 | +
|
| 38 | + - name: Update version in pyproject.toml |
| 39 | + shell: pwsh |
| 40 | + run: | |
| 41 | + $version = "${{ steps.get_version.outputs.VERSION }}" |
| 42 | + $content = Get-Content pyproject.toml -Raw |
| 43 | + $content = $content -replace 'version = "[^"]+"', "version = `"$version`"" |
| 44 | + Set-Content pyproject.toml $content |
| 45 | +
|
| 46 | + - name: Build executable with PyInstaller |
| 47 | + run: uv run pyinstaller mechbay.spec --clean |
| 48 | + |
| 49 | + - name: Create distribution folder |
| 50 | + shell: pwsh |
| 51 | + run: | |
| 52 | + $version = "${{ steps.get_version.outputs.VERSION }}" |
| 53 | + $distFolder = "dist/MechBay_v$version" |
| 54 | +
|
| 55 | + # Create folder and copy files |
| 56 | + New-Item -ItemType Directory -Path $distFolder -Force | Out-Null |
| 57 | + Copy-Item -Recurse "dist/MechBay/*" $distFolder |
| 58 | + Copy-Item ".env.example" "$distFolder/.env.example" |
| 59 | +
|
| 60 | + # Generate README.txt (use PowerShell here-string in script) |
| 61 | + $readme = "MechBay v$version`n" + |
| 62 | + "================`n`n" + |
| 63 | + "GETTING STARTED`n" + |
| 64 | + "---------------`n" + |
| 65 | + "1. Double-click MechBay.exe to start the application`n" + |
| 66 | + "2. Your web browser will automatically open to http://127.0.0.1:5001`n" + |
| 67 | + "3. The application runs locally on your computer (no internet required)`n" + |
| 68 | + "4. Close the terminal window to stop the server`n`n" + |
| 69 | + "DATABASE LOCATION`n" + |
| 70 | + "-----------------`n" + |
| 71 | + "Your miniature inventory is stored in:`n" + |
| 72 | + " %APPDATA%\MechBay\mechbay.db`n`n" + |
| 73 | + "This is typically located at:`n" + |
| 74 | + " C:\Users\<YourUsername>\AppData\Roaming\MechBay\mechbay.db`n`n" + |
| 75 | + "BACKING UP YOUR DATA`n" + |
| 76 | + "--------------------`n" + |
| 77 | + "Method 1 - Direct Database Backup (Recommended):`n" + |
| 78 | + " 1. Close MechBay if it's running`n" + |
| 79 | + " 2. Copy the mechbay.db file from %APPDATA%\MechBay\ to a safe location`n" + |
| 80 | + " 3. To restore, copy the backup file back to %APPDATA%\MechBay\`n`n" + |
| 81 | + "Method 2 - JSON Export/Import:`n" + |
| 82 | + " 1. In the web interface, go to Miniatures, Forces, or Lance Templates`n" + |
| 83 | + " 2. Click 'Export JSON' to download your data`n" + |
| 84 | + " 3. Save the JSON file in a safe location`n" + |
| 85 | + " 4. To restore, use the 'Import JSON' feature`n`n" + |
| 86 | + "UPDATING TO A NEW VERSION`n" + |
| 87 | + "--------------------------`n" + |
| 88 | + "1. Backup your database (see above)`n" + |
| 89 | + "2. Download the new version`n" + |
| 90 | + "3. Extract and run - your data in %APPDATA% will be preserved`n" + |
| 91 | + "4. If you encounter issues, restore from your backup`n`n" + |
| 92 | + "TROUBLESHOOTING`n" + |
| 93 | + "---------------`n" + |
| 94 | + "- If the browser doesn't open automatically, navigate to http://127.0.0.1:5001`n" + |
| 95 | + "- If port 5001 is already in use, close other applications`n" + |
| 96 | + "- For issues, check the terminal window for error messages`n" + |
| 97 | + "- Visit https://github.com/cantis/MechBay for support`n`n" + |
| 98 | + "CONFIGURATION (Advanced)`n" + |
| 99 | + "------------------------`n" + |
| 100 | + "Create a .env file in the same folder as MechBay.exe to customize settings.`n" + |
| 101 | + "See .env.example for available options." |
| 102 | +
|
| 103 | + Set-Content -Path "$distFolder/README.txt" -Value $readme |
| 104 | +
|
| 105 | + - name: Create ZIP archive |
| 106 | + shell: pwsh |
| 107 | + run: | |
| 108 | + $version = "${{ steps.get_version.outputs.VERSION }}" |
| 109 | + $distFolder = "dist/MechBay_v$version" |
| 110 | + $zipFile = "MechBay_v$version-windows.zip" |
| 111 | +
|
| 112 | + Compress-Archive -Path $distFolder -DestinationPath $zipFile |
| 113 | + echo "ZIP_FILE=$zipFile" >> $env:GITHUB_OUTPUT |
| 114 | + id: create_zip |
| 115 | + |
| 116 | + - name: Upload release asset |
| 117 | + uses: softprops/action-gh-release@v1 |
| 118 | + with: |
| 119 | + files: MechBay_v${{ steps.get_version.outputs.VERSION }}-windows.zip |
| 120 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 121 | + |
| 122 | + - name: Upload build artifacts |
| 123 | + uses: actions/upload-artifact@v4 |
| 124 | + with: |
| 125 | + name: mechbay-windows-${{ steps.get_version.outputs.VERSION }} |
| 126 | + path: dist/MechBay_v${{ steps.get_version.outputs.VERSION }}/ |
| 127 | + retention-days: 30 |
0 commit comments