144 lines
		
	
	
	
		
			4 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			144 lines
		
	
	
	
		
			4 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| name: Build AppImage, Windows EXE and Publish Release
 | |
| 
 | |
| on:
 | |
|   push:
 | |
|     branches:
 | |
|       - main
 | |
|     tags:
 | |
|       - 'v*.*.*'
 | |
|   workflow_dispatch:
 | |
| 
 | |
| permissions:
 | |
|   contents: write
 | |
|   releases: write
 | |
| 
 | |
| jobs:
 | |
|   build-linux:
 | |
|     runs-on: ubuntu-latest
 | |
|     name: Build AppImage
 | |
|     outputs:
 | |
|       artifact_path: ${{ steps.upload_artifacts.outputs.artifact_path }}
 | |
|     steps:
 | |
|       - name: Checkout repository
 | |
|         uses: actions/checkout@v3
 | |
| 
 | |
|       - name: Set up Python
 | |
|         uses: actions/setup-python@v4
 | |
|         with:
 | |
|           python-version: "3.x"
 | |
| 
 | |
|       - name: Install PyInstaller and dependencies
 | |
|         run: pip install pyinstaller
 | |
| 
 | |
|       - name: Build Linux executable with PyInstaller
 | |
|         run: |
 | |
|           pyinstaller --onefile --windowed time_logix.py
 | |
| 
 | |
|       - name: Create AppDir and Files
 | |
|         run: |
 | |
|           mkdir -p AppDir/usr/bin
 | |
|           cp dist/time_logix AppDir/usr/bin/time_logix
 | |
|           # Create AppRun file
 | |
|           cat <<'EOF' > AppDir/AppRun
 | |
|           #!/bin/bash
 | |
|           HERE="$(dirname "$(readlink -f "${0}")")"
 | |
|           exec "$HERE/usr/bin/time_logix" "$@"
 | |
|           EOF
 | |
|           chmod +x AppDir/AppRun
 | |
|           # Create desktop file with icon reference
 | |
|           cat <<EOF > AppDir/time_logix.desktop
 | |
|           [Desktop Entry]
 | |
|           Type=Application
 | |
|           Name=TimeLogix
 | |
|           Exec=time_logix
 | |
|           Icon=appicon
 | |
|           Comment=Time tracking app for contractors
 | |
|           Categories=Utility;
 | |
|           EOF
 | |
|           # Download a placeholder icon and save it as appicon.png in AppDir
 | |
|           wget -q -O AppDir/appicon.png https://placehold.co/256
 | |
| 
 | |
|       - name: Install FUSE library
 | |
|         run: sudo apt-get update && sudo apt-get install -y libfuse2
 | |
| 
 | |
|       - name: Download appimagetool
 | |
|         run: |
 | |
|           wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
 | |
|           chmod +x appimagetool-x86_64.AppImage
 | |
| 
 | |
|       - name: Build AppImage
 | |
|         run: ./appimagetool-x86_64.AppImage AppDir
 | |
| 
 | |
|       - name: Upload Linux Artifact
 | |
|         id: upload_artifacts
 | |
|         uses: actions/upload-artifact@v4
 | |
|         with:
 | |
|           name: TimeLogix-AppImage
 | |
|           path: TimeLogix*-x86_64.AppImage
 | |
| 
 | |
|   build-windows:
 | |
|     runs-on: windows-latest
 | |
|     name: Build Windows Executable
 | |
|     steps:
 | |
|       - name: Checkout repository
 | |
|         uses: actions/checkout@v3
 | |
| 
 | |
|       - name: Set up Python
 | |
|         uses: actions/setup-python@v4
 | |
|         with:
 | |
|           python-version: "3.x"
 | |
| 
 | |
|       - name: Install PyInstaller
 | |
|         run: pip install pyinstaller
 | |
| 
 | |
|       - name: Build Windows executable with PyInstaller
 | |
|         run: pyinstaller --onefile --windowed time_logix.py
 | |
| 
 | |
|       - name: Upload Windows Artifact
 | |
|         uses: actions/upload-artifact@v4
 | |
|         with:
 | |
|           name: TimeLogix-Windows
 | |
|           path: dist/time_logix.exe
 | |
| 
 | |
|   release:
 | |
|     name: Publish Release
 | |
|     needs:
 | |
|       - build-linux
 | |
|       - build-windows
 | |
|     runs-on: ubuntu-latest
 | |
|     steps:
 | |
|       - name: Retrieve Linux artifact
 | |
|         uses: actions/download-artifact@v4
 | |
|         with:
 | |
|           name: TimeLogix-AppImage
 | |
| 
 | |
|       - name: Retrieve Windows artifact
 | |
|         uses: actions/download-artifact@v4
 | |
|         with:
 | |
|           name: TimeLogix-Windows
 | |
| 
 | |
|       - name: Create GitHub Release
 | |
|         id: create_release
 | |
|         uses: softprops/action-gh-release@v2
 | |
|         with:
 | |
|           tag_name: ${{ github.ref }}
 | |
|         env:
 | |
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | |
| 
 | |
|       - name: Upload Linux AppImage to Release
 | |
|         shell: bash
 | |
|         run: |
 | |
|           gh release upload ${{ github.ref_name }} ./$(ls | grep AppImage) \
 | |
|           --name TimeLogix-AppImage.AppImage \
 | |
|           --label "Linux AppImage"
 | |
|         env:
 | |
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | |
| 
 | |
|       - name: Upload Windows EXE to Release
 | |
|         shell: bash
 | |
|         run: |
 | |
|           gh release upload ${{ github.ref_name }} ./$(ls | grep .exe) \
 | |
|           --name TimeLogix-Windows.exe \
 | |
|           --label "Windows Executable"
 | |
|         env:
 | |
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
