Add GitHub automation and reviewer request configuration (#24) #18
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 Build | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - 'docs/**' | |
| - 'README.md' | |
| - 'CHANGELOG.md' | |
| - 'LICENSE' | |
| - '*.md' | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Read version from python/config.py — shared across all jobs | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| get-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.ver.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: ver | |
| run: | | |
| VERSION=$(grep -oP 'VERSION\s*=\s*"\K[^"]+' python/config.py) | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Building MetaLens v$VERSION" | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Windows build → .exe installer (Squirrel) | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| build-windows: | |
| needs: get-version | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: pip | |
| cache-dependency-path: python/requirements.txt | |
| - name: Build Python sidecar | |
| shell: pwsh | |
| run: | | |
| cd python | |
| pip install -r requirements.txt -q | |
| pip install pyinstaller -q | |
| python -m PyInstaller main.py --onefile --name metalens-sidecar --distpath dist --clean --noconfirm ` | |
| --hidden-import piexif ` | |
| --hidden-import mutagen ` | |
| --hidden-import hachoir ` | |
| --hidden-import olefile ` | |
| --hidden-import openpyxl ` | |
| --hidden-import docx ` | |
| --hidden-import pptx ` | |
| --hidden-import pypdf | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Build React frontend | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm run build | |
| - name: Copy frontend dist into electron | |
| run: cp -r frontend/dist electron/frontend | |
| - name: Sync electron/package.json version from python/config.py | |
| run: | | |
| cd electron | |
| npm version ${{ needs.get-version.outputs.version }} --no-git-tag-version --allow-same-version | |
| - name: Package with Electron Forge | |
| run: | | |
| cd electron | |
| npm ci --include=dev | |
| npx electron-forge make | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-installer | |
| path: electron/out/make/**/*.exe | |
| if-no-files-found: error | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Linux build → .deb + .rpm + .tar.gz packages | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| build-linux: | |
| needs: get-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: sudo apt-get update -qq && sudo apt-get install -y rpm fakeroot | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: pip | |
| cache-dependency-path: python/requirements.txt | |
| - name: Build Python sidecar | |
| run: | | |
| cd python | |
| pip install -r requirements.txt -q | |
| pip install pyinstaller -q | |
| python -m PyInstaller main.py --onefile --name metalens-sidecar --distpath dist --clean --noconfirm \ | |
| --hidden-import piexif \ | |
| --hidden-import mutagen \ | |
| --hidden-import hachoir \ | |
| --hidden-import olefile \ | |
| --hidden-import openpyxl \ | |
| --hidden-import docx \ | |
| --hidden-import pptx \ | |
| --hidden-import pypdf | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Build React frontend | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm run build | |
| - name: Copy frontend dist into electron | |
| run: cp -r frontend/dist electron/frontend | |
| - name: Sync electron/package.json version from python/config.py | |
| run: | | |
| cd electron | |
| npm version ${{ needs.get-version.outputs.version }} --no-git-tag-version --allow-same-version | |
| - name: Configure RPM macros (prevent Build ID conflicts on Fedora/RHEL) | |
| # rpmbuild reads ~/.rpmmacros before building. Setting _build_id_links none | |
| # prevents the RPM from including /usr/lib/.build-id/ symlinks as package files, | |
| # which eliminates conflicts between multiple Electron apps on RPM-based distros. | |
| run: echo '%_build_id_links none' >> ~/.rpmmacros | |
| - name: Package with Electron Forge | |
| run: | | |
| cd electron | |
| npm ci --include=dev | |
| npx electron-forge make | |
| - name: Create Linux tar.gz (portable archive) | |
| run: | | |
| VERSION=${{ needs.get-version.outputs.version }} | |
| APP_DIR=$(find electron/out -maxdepth 1 -type d -name "MetaLens-linux-*" | head -1) | |
| if [ -n "$APP_DIR" ]; then | |
| tar -czf "electron/out/make/MetaLens-${VERSION}-Linux.tar.gz" \ | |
| -C "$(dirname "$APP_DIR")" "$(basename "$APP_DIR")" | |
| echo "Created MetaLens-${VERSION}-Linux.tar.gz" | |
| else | |
| echo "Warning: no MetaLens-linux-* directory found, skipping tar.gz" | |
| fi | |
| - name: Upload Linux artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-packages | |
| path: | | |
| electron/out/make/**/*.deb | |
| electron/out/make/**/*.rpm | |
| electron/out/make/**/*.tar.gz | |
| if-no-files-found: error | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Publish GitHub Release with all artifacts | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| release: | |
| needs: [get-version, build-windows, build-linux] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List artifacts | |
| run: find artifacts -type f | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.get-version.outputs.version }} | |
| name: MetaLens v${{ needs.get-version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| make_latest: true | |
| files: | | |
| artifacts/windows-installer/** | |
| artifacts/linux-packages/** |