|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build on ${{ matrix.os }} |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 17 | + python-version: ["3.12"] |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install System Dependencies (Linux) |
| 24 | + if: matrix.os == 'ubuntu-latest' |
| 25 | + run: | |
| 26 | + sudo apt-get update |
| 27 | + sudo apt-get install -y libxcb-cursor0 |
| 28 | +
|
| 29 | + - name: Set up Python ${{ matrix.python-version }} |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + cache: 'pip' |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + run: | |
| 37 | + python -m pip install --upgrade pip |
| 38 | + pip install -r requirements.txt |
| 39 | + pip install pyinstaller |
| 40 | +
|
| 41 | + - name: Build executable (Windows) |
| 42 | + if: matrix.os == 'windows-latest' |
| 43 | + run: | |
| 44 | + pyinstaller --noconfirm --onedir --windowed --add-data "alem.png;." --name "Alem" launch_enhanced.py |
| 45 | +
|
| 46 | + - name: Build executable (macOS/Linux) |
| 47 | + if: matrix.os != 'windows-latest' |
| 48 | + run: | |
| 49 | + pyinstaller --noconfirm --onedir --windowed --add-data "alem.png:." --name "Alem" launch_enhanced.py |
| 50 | +
|
| 51 | + - name: Upload artifact (Windows) |
| 52 | + if: matrix.os == 'windows-latest' |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: Alem-Windows |
| 56 | + path: dist/Alem |
| 57 | + |
| 58 | + - name: Upload artifact (Linux) |
| 59 | + if: matrix.os == 'ubuntu-latest' |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: Alem-Linux |
| 63 | + path: dist/Alem |
| 64 | + |
| 65 | + - name: Upload artifact (macOS) |
| 66 | + if: matrix.os == 'macos-latest' |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: Alem-macOS |
| 70 | + path: dist/Alem |
| 71 | + |
| 72 | + release: |
| 73 | + name: Create Release |
| 74 | + needs: build |
| 75 | + runs-on: ubuntu-latest |
| 76 | + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') |
| 77 | + |
| 78 | + steps: |
| 79 | + - name: Checkout code |
| 80 | + uses: actions/checkout@v4 |
| 81 | + |
| 82 | + - name: Download Windows artifact |
| 83 | + uses: actions/download-artifact@v4 |
| 84 | + with: |
| 85 | + name: Alem-Windows |
| 86 | + path: Alem-Windows |
| 87 | + |
| 88 | + - name: Download Linux artifact |
| 89 | + uses: actions/download-artifact@v4 |
| 90 | + with: |
| 91 | + name: Alem-Linux |
| 92 | + path: Alem-Linux |
| 93 | + |
| 94 | + - name: Download macOS artifact |
| 95 | + uses: actions/download-artifact@v4 |
| 96 | + with: |
| 97 | + name: Alem-macOS |
| 98 | + path: Alem-macOS |
| 99 | + |
| 100 | + - name: Zip artifacts |
| 101 | + run: | |
| 102 | + cd Alem-Windows && zip -r ../Alem-Windows.zip . && cd .. |
| 103 | + cd Alem-Linux && zip -r ../Alem-Linux.zip . && cd .. |
| 104 | + cd Alem-macOS && zip -r ../Alem-macOS.zip . && cd .. |
| 105 | +
|
| 106 | + - name: Generate timestamp tag |
| 107 | + if: github.ref == 'refs/heads/main' |
| 108 | + id: tagger |
| 109 | + run: echo "tag=v$(date +'%Y.%m.%d-%H%M%S')" >> $GITHUB_OUTPUT |
| 110 | + |
| 111 | + - name: Release |
| 112 | + uses: softprops/action-gh-release@v1 |
| 113 | + with: |
| 114 | + tag_name: ${{ github.ref == 'refs/heads/main' && steps.tagger.outputs.tag || github.ref_name }} |
| 115 | + files: | |
| 116 | + Alem-Windows.zip |
| 117 | + Alem-Linux.zip |
| 118 | + Alem-macOS.zip |
| 119 | + env: |
| 120 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments