fix: resolve PyInstaller build issues and enhance timeout handling #55
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: Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| bump_version: | |
| if: "!startsWith(github.event.head_commit.message, 'bump:')" | |
| runs-on: ubuntu-latest | |
| name: "Bump version and create changelog with commitizen" | |
| outputs: | |
| revision: ${{ steps.cz.outputs.version }} | |
| changelog: ${{ steps.cz.outputs.changelog_path }} | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| - id: cz | |
| name: Create bump and changelog | |
| uses: commitizen-tools/commitizen-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| changelog_increment_filename: body.md | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: body.md | |
| path: | | |
| body.md | |
| - name: Set Outputs | |
| run: | | |
| echo "REVISION=${{ steps.cz.outputs.version }}" >> $GITHUB_ENV | |
| echo "CHANGELOG_PATH=changelog-${{ steps.cz.outputs.version }}.md" >> $GITHUB_ENV | |
| id: set_output | |
| build: | |
| needs: bump_version | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| architecture: [x86_64, arm64] | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| - name: Build executables | |
| run: | | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| pyinstaller --onefile cli/main.py --name "codethreat-cli.exe" --icon=ct.ico \ | |
| --add-data "cli;cli" \ | |
| --hidden-import cli.scan \ | |
| --hidden-import cli.auth \ | |
| --hidden-import cli.utils \ | |
| --hidden-import requests \ | |
| --hidden-import click \ | |
| --hidden-import colorama \ | |
| --hidden-import zipfile \ | |
| --hidden-import tempfile \ | |
| --hidden-import datetime \ | |
| --hidden-import platform \ | |
| --hidden-import socket \ | |
| --hidden-import fnmatch \ | |
| --collect-submodules cli | |
| else | |
| pyinstaller --onefile cli/main.py --name "codethreat-cli" --icon=ct.ico \ | |
| --add-data "cli:cli" \ | |
| --hidden-import cli.scan \ | |
| --hidden-import cli.auth \ | |
| --hidden-import cli.utils \ | |
| --hidden-import requests \ | |
| --hidden-import click \ | |
| --hidden-import colorama \ | |
| --hidden-import zipfile \ | |
| --hidden-import tempfile \ | |
| --hidden-import datetime \ | |
| --hidden-import platform \ | |
| --hidden-import socket \ | |
| --hidden-import fnmatch \ | |
| --collect-submodules cli | |
| fi | |
| shell: bash | |
| - name: Archive the build output for Windows | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| Compress-Archive -Path dist\codethreat-cli.exe -DestinationPath dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-${{ matrix.architecture }}-${{ matrix.os }}.zip | |
| shell: pwsh | |
| - name: Archive the build output for Linux and macOS | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| tar -czvf dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-${{ matrix.architecture }}-${{ matrix.os }}.tar.gz -C dist codethreat-cli | |
| shell: bash | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codethreat-cli-${{ needs.bump_version.outputs.revision }}-${{ matrix.architecture }}-${{ matrix.os }} | |
| path: | | |
| dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-${{ matrix.architecture }}-${{ matrix.os }}.* | |
| release-artifacts: | |
| needs: [bump_version, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: List files in dist directory | |
| run: ls -lR dist | |
| - name: Create GitHub release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.bump_version.outputs.revision }} | |
| name: "codethreat-cli ${{ needs.bump_version.outputs.revision }}" | |
| body_path: dist/body.md/body.md | |
| draft: false | |
| prerelease: false | |
| files: | | |
| dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-arm64-macos-latest/codethreat-cli-${{ needs.bump_version.outputs.revision }}-arm64-macos-latest.tar.gz | |
| dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-arm64-ubuntu-latest/codethreat-cli-${{ needs.bump_version.outputs.revision }}-arm64-ubuntu-latest.tar.gz | |
| dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-arm64-windows-latest/codethreat-cli-${{ needs.bump_version.outputs.revision }}-arm64-windows-latest.zip | |
| dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-x86_64-macos-latest/codethreat-cli-${{ needs.bump_version.outputs.revision }}-x86_64-macos-latest.tar.gz | |
| dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-x86_64-ubuntu-latest/codethreat-cli-${{ needs.bump_version.outputs.revision }}-x86_64-ubuntu-latest.tar.gz | |
| dist/codethreat-cli-${{ needs.bump_version.outputs.revision }}-x86_64-windows-latest/codethreat-cli-${{ needs.bump_version.outputs.revision }}-x86_64-windows-latest.zip | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |