From 640588dc96adcad010f087ce66e0996e3700dd93 Mon Sep 17 00:00:00 2001 From: David Kushniruk <105581554+kdavjd@users.noreply.github.com> Date: Sun, 17 Nov 2024 15:09:28 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-pid-sim-app.yml | 104 ++++++++++++------------ 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build-pid-sim-app.yml b/.github/workflows/build-pid-sim-app.yml index e0537d1..546b570 100644 --- a/.github/workflows/build-pid-sim-app.yml +++ b/.github/workflows/build-pid-sim-app.yml @@ -4,65 +4,69 @@ on: push: branches: [ "main" ] +permissions: + contents: write + releases: write + jobs: build-and-release: runs-on: windows-latest steps: - # 1. Checkout the repository - - uses: actions/checkout@v4 + # 1. Checkout the repository + - uses: actions/checkout@v4 - # 2. Set up Python - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: "3.12" + # 2. Set up Python + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.12" - # 3. Install dependencies using Poetry - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry - poetry install + # 3. Install dependencies using Poetry + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install - # 4. Install PyInstaller - - name: Install PyInstaller - run: | - pip install pyinstaller + # 4. Install PyInstaller + - name: Install PyInstaller + run: | + pip install pyinstaller - # 5. Build the executable with PyInstaller - - name: Build executable with PyInstaller - run: | - pyinstaller --onefile --name pid-sim src/gui/main.py + # 5. Build the executable with PyInstaller + - name: Build executable with PyInstaller + run: | + pyinstaller --onefile --name pid-sim src/gui/main.py - # 6. Verify the build (опционально) - - name: Verify executable - run: | - if (!(Test-Path "dist\pid-sim.exe")) { - Write-Error "Executable not found!" - exit 1 - } + # 6. Verify the build (optional) + - name: Verify executable + run: | + if (!(Test-Path "dist\pid-sim.exe")) { + Write-Error "Executable not found!" + exit 1 + } - # 7. Create a GitHub Release - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: "release-${{ github.run_number }}" - release_name: "Release ${{ github.run_number }}" - body: "Автоматически сгенерированный релиз." - draft: false - prerelease: false + # 7. Create a GitHub Release + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "release-${{ github.run_number }}" + release_name: "Release ${{ github.run_number }}" + body: "Автоматически сгенерированный релиз." + draft: false + prerelease: false - # 8. Upload the executable as a release asset - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/pid-sim.exe - asset_name: pid-sim.exe - asset_content_type: application/octet-stream + # 8. Upload the executable as a release asset + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/pid-sim.exe + asset_name: pid-sim.exe + asset_content_type: application/octet-stream