edit button #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| # ทำงานเมื่อมีการ Push Tag ที่ขึ้นต้นด้วย v (เช่น v1.0, v1.0.1) | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| # สั่งให้รันบนทั้ง Windows และ Linux (Ubuntu) | |
| os: [windows-latest, ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install Dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| # --- ส่วนของ Windows --- | |
| - name: Build EXE (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| # เพิ่ม --hidden-import "PIL._tkinter_finder" | |
| pyinstaller --noconfirm --onefile --windowed --name "MoneyManager" --add-data "config;config" --hidden-import "PIL._tkinter_finder" app.py | |
| # --- ส่วนของ Linux --- | |
| - name: Build Binary (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| # เพิ่ม --hidden-import "PIL._tkinter_finder" | |
| pyinstaller --noconfirm --onefile --windowed --name "MoneyManager" --add-data "config:config" --hidden-import "PIL._tkinter_finder" app.py | |
| # --- แพ็คของเตรียมส่ง (Windows) --- | |
| - name: Zip Artifact (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| powershell Compress-Archive -Path dist/MoneyManager.exe -DestinationPath MoneyManager-Windows-${{ github.ref_name }}.zip | |
| # --- แพ็คของเตรียมส่ง (Linux) --- | |
| - name: Zip Artifact (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| cd dist | |
| zip -r ../MoneyManager-Linux-${{ github.ref_name }}.zip MoneyManager | |
| # --- อัปโหลดขึ้นหน้า Releases --- | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: | | |
| MoneyManager-Windows-${{ github.ref_name }}.zip | |
| MoneyManager-Linux-${{ github.ref_name }}.zip |