Merge pull request #11 from BOSSincrypto/devin/1780855870-fix-release… #6
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 & Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| name: Windows | |
| - os: ubuntu-22.04 | |
| name: Linux | |
| - os: macos-latest | |
| name: macOS | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| # ────────── Windows ────────── | |
| - name: Build Windows executable | |
| if: matrix.name == 'Windows' | |
| run: | | |
| pyinstaller --onefile --windowed \ | |
| --icon=resources/icon.ico \ | |
| --collect-data customtkinter \ | |
| --collect-data magika \ | |
| --name MarkItDown \ | |
| run.py | |
| shell: bash | |
| - name: Build Windows Installer | |
| if: matrix.name == 'Windows' | |
| env: | |
| APP_VERSION: ${{ github.ref_name }} | |
| run: iscc installer.iss | |
| shell: cmd | |
| # ────────── macOS ────────── | |
| - name: Create macOS icon | |
| if: matrix.name == 'macOS' | |
| run: | | |
| mkdir -p resources/icon.iconset | |
| cp resources/icon_16.png resources/icon.iconset/icon_16x16.png | |
| cp resources/icon_32.png resources/icon.iconset/icon_16x16@2x.png | |
| cp resources/icon_32.png resources/icon.iconset/icon_32x32.png | |
| cp resources/icon_64.png resources/icon.iconset/icon_32x32@2x.png | |
| cp resources/icon_128.png resources/icon.iconset/icon_128x128.png | |
| cp resources/icon_256.png resources/icon.iconset/icon_128x128@2x.png | |
| cp resources/icon_256.png resources/icon.iconset/icon_256x256.png | |
| cp resources/icon_512.png resources/icon.iconset/icon_256x256@2x.png | |
| cp resources/icon_512.png resources/icon.iconset/icon_512x512.png | |
| cp resources/icon_1024.png resources/icon.iconset/icon_512x512@2x.png | |
| iconutil -c icns resources/icon.iconset -o resources/icon.icns | |
| - name: Build macOS app bundle | |
| if: matrix.name == 'macOS' | |
| run: | | |
| pyinstaller --onedir --windowed \ | |
| --icon=resources/icon.icns \ | |
| --osx-bundle-identifier com.bossincrypto.markitdown \ | |
| --collect-data customtkinter \ | |
| --collect-data magika \ | |
| --name MarkItDown \ | |
| run.py | |
| cd dist | |
| zip -r -y MarkItDown-macOS.zip MarkItDown.app | |
| # ────────── Linux ────────── | |
| - name: Build Linux executable | |
| if: matrix.name == 'Linux' | |
| run: | | |
| pyinstaller --onefile \ | |
| --icon=resources/icon.png \ | |
| --collect-data customtkinter \ | |
| --collect-data magika \ | |
| --name MarkItDown \ | |
| run.py | |
| - name: Package Linux AppImage | |
| if: matrix.name == 'Linux' | |
| run: | | |
| mkdir -p MarkItDown.AppDir/usr/bin | |
| cp dist/MarkItDown MarkItDown.AppDir/usr/bin/ | |
| cat > MarkItDown.AppDir/AppRun << 'EOF' | |
| #!/bin/bash | |
| SELF="$(readlink -f "$0")" | |
| HERE="${SELF%/*}" | |
| exec "${HERE}/usr/bin/MarkItDown" "$@" | |
| EOF | |
| chmod +x MarkItDown.AppDir/AppRun | |
| cat > MarkItDown.AppDir/MarkItDown.desktop << 'EOF' | |
| [Desktop Entry] | |
| Name=MarkItDown | |
| Exec=MarkItDown | |
| Icon=markitdown | |
| Type=Application | |
| Categories=Utility; | |
| EOF | |
| cp resources/icon.png MarkItDown.AppDir/markitdown.png | |
| wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O appimagetool | |
| chmod +x appimagetool | |
| ./appimagetool --appimage-extract > /dev/null 2>&1 | |
| ARCH=x86_64 ./squashfs-root/AppRun MarkItDown.AppDir dist/MarkItDown-Linux.AppImage | |
| # ────────── Upload ────────── | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MarkItDown-${{ matrix.name }} | |
| path: | | |
| dist/MarkItDown-Windows-Setup.exe | |
| dist/MarkItDown-macOS.zip | |
| dist/MarkItDown-Linux.AppImage | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: artifacts/**/* |