feat: 3.2.09 #34
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 AvitoParser | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Read version | |
| id: version | |
| shell: pwsh | |
| run: | | |
| $versionLine = Get-Content version.py | Select-String -Pattern 'VERSION\s*=\s*"(.*)"' | |
| $VERSION = $versionLine.Matches[0].Groups[1].Value | |
| echo "version=$VERSION" >> $env:GITHUB_OUTPUT | |
| - name: Check if release already exists | |
| id: release_check | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const version = "${{ steps.version.outputs.version }}" | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| const exists = releases.data.some(r => r.tag_name === `v${version}`); | |
| return exists; | |
| - name: Skip if release exists | |
| if: steps.release_check.outputs.result == 'true' | |
| run: | | |
| Write-Output "Release for this version already exists, skipping build." | |
| exit 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install -r requirements.txt | |
| - name: Build exe | |
| shell: cmd | |
| run: | | |
| pyinstaller AvitoParser.py ^ | |
| --name AvitoParser ^ | |
| --onefile ^ | |
| --noconsole ^ | |
| --icon=assets/logo.ico ^ | |
| --collect-all flet ^ | |
| --collect-all playwright ^ | |
| --collect-all playwright_stealth ^ | |
| --collect-all pyexcel ^ | |
| --collect-all pyexcel_xlsx ^ | |
| --collect-all pyexcel_io ^ | |
| --collect-all openpyxl ^ | |
| --hidden-import playwright_stealth ^ | |
| --hidden-import httpx ^ | |
| --add-data "config.toml;." ^ | |
| --add-data "assets;assets" | |
| - name: Create ZIP archive | |
| shell: pwsh | |
| run: | | |
| $version = "${{ steps.version.outputs.version }}" | |
| Compress-Archive -Path dist\AvitoParser.exe, config.toml -DestinationPath dist\AvitoParser_$version.zip | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: AvitoParser-${{ steps.version.outputs.version }} | |
| path: dist/AvitoParser_${{ steps.version.outputs.version }}.zip | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: Release ${{ steps.version.outputs.version }} | |
| body: | | |
| Автоматическая сборка версии **${{ steps.version.outputs.version }}** | |
| files: dist/AvitoParser_${{ steps.version.outputs.version }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |