Merge pull request #45 from TomiXRM/fix/appimage-gs-usb-label #69
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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| UV_PYTHON: '3.12' | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact: Linux-AppImage-x86_64 | |
| - os: ubuntu-24.04-arm | |
| artifact: Linux-AppImage-arm64 | |
| - os: windows-latest | |
| artifact: windows-x86_64 | |
| - os: macos-latest | |
| artifact: macos-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 uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync --locked --all-groups | |
| - name: Check formatting | |
| run: uv run --locked --group dev ruff format --check . | |
| - name: Lint | |
| run: uv run --locked --group dev ruff check . | |
| - name: Type check with ty | |
| run: uv run --locked --group dev ty check . | |
| - name: Type check with mypy | |
| run: uv run --locked --group dev mypy . | |
| - name: Import Apple signing certificate | |
| if: matrix.os == 'macos-latest' | |
| env: | |
| MACOS_CERTIFICATE_BASE64: ${{ secrets.MACOS_CERTIFICATE_BASE64 }} | |
| MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} | |
| MACOS_KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} | |
| run: | | |
| if [ -z "$MACOS_CERTIFICATE_BASE64" ]; then | |
| echo "MACOS_CERTIFICATE_BASE64 is not set; building unsigned macOS artifacts." | |
| exit 0 | |
| fi | |
| CERTIFICATE_PATH="$RUNNER_TEMP/developer_id_application.p12" | |
| KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db" | |
| echo -n "$MACOS_CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH" | |
| security create-keychain -p "$MACOS_KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | |
| security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" | |
| security unlock-keychain -p "$MACOS_KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | |
| security import "$CERTIFICATE_PATH" -P "$MACOS_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" | |
| security list-keychain -d user -s "$KEYCHAIN_PATH" | |
| security set-key-partition-list -S apple-tool:,apple: -s -k "$MACOS_KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" | |
| security find-identity -v -p codesigning "$KEYCHAIN_PATH" | |
| - name: Build with Nuitka | |
| env: | |
| MACOS_SIGN_IDENTITY: ${{ secrets.MACOS_SIGN_IDENTITY }} | |
| run: uv run --locked --group build python scripts/build_nuitka.py --clean --dmg --appimage | |
| - name: Notarize macOS DMG | |
| if: matrix.os == 'macos-latest' | |
| env: | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| run: | | |
| if [ -z "$APPLE_ID" ] || [ -z "$APPLE_APP_SPECIFIC_PASSWORD" ] || [ -z "$APPLE_TEAM_ID" ]; then | |
| echo "Apple notarization secrets are not set; skipping notarization." | |
| exit 0 | |
| fi | |
| xcrun notarytool submit dist/CANViewer.dmg \ | |
| --apple-id "$APPLE_ID" \ | |
| --password "$APPLE_APP_SPECIFIC_PASSWORD" \ | |
| --team-id "$APPLE_TEAM_ID" \ | |
| --wait | |
| xcrun stapler staple dist/CANViewer.dmg | |
| xcrun stapler validate dist/CANViewer.dmg | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: | | |
| dist/CANViewer-*.AppImage | |
| dist/install_linux_desktop.sh | |
| dist/CANViewer.png | |
| dist/CANViewer.exe | |
| dist/CANViewer.dmg | |
| if-no-files-found: error | |
| release: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| actions: write | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Download Artifacts (Linux AppImage x86_64) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: Linux-AppImage-x86_64 | |
| path: Linux-AppImage-x86_64 | |
| - name: Download Artifacts (Linux AppImage arm64) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: Linux-AppImage-arm64 | |
| path: Linux-AppImage-arm64 | |
| - name: Download Artifacts (Windows) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-x86_64 | |
| path: windows | |
| - name: Download Artifacts (macOS) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-arm64 | |
| path: macos | |
| - name: Package Linux AppImage artifacts | |
| run: | | |
| zip -j CANViewer_Linux-AppImage_x86_64.zip \ | |
| Linux-AppImage-x86_64/CANViewer-*.AppImage \ | |
| Linux-AppImage-x86_64/install_linux_desktop.sh \ | |
| Linux-AppImage-x86_64/CANViewer.png | |
| zip -j CANViewer_Linux-AppImage_arm64.zip \ | |
| Linux-AppImage-arm64/CANViewer-*.AppImage \ | |
| Linux-AppImage-x86_64/install_linux_desktop.sh \ | |
| Linux-AppImage-x86_64/CANViewer.png | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| CANViewer_Linux-AppImage_x86_64.zip | |
| CANViewer_Linux-AppImage_arm64.zip | |
| windows/CANViewer.exe | |
| macos/CANViewer.dmg | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |