Delete .claude directory #15
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 Publish Electron App | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} - ${{ matrix.arch }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: linux | |
| arch: x64 | |
| - os: ubuntu-latest | |
| target: linux | |
| arch: arm64 | |
| - os: macos-latest | |
| target: mac | |
| arch: x64 | |
| - os: macos-latest | |
| target: mac | |
| arch: arm64 | |
| - os: windows-latest | |
| target: win | |
| arch: x64 | |
| - os: windows-latest | |
| target: win | |
| arch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20.x' | |
| - name: Install Python to fix node-gyp issues | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Cache Node.js modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-modules- | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| npm install -g @electron/rebuild | |
| - name: Manually install dmg-license (macOS only) | |
| if: matrix.os == 'macos-latest' | |
| run: npm install dmg-license | |
| - name: Rebuild native dependencies | |
| run: | | |
| npx @electron/rebuild -f | |
| env: | |
| PYTHON: python3 | |
| - name: Build for production with electron-builder | |
| run: npm run build:${{ matrix.target }}:${{ matrix.arch }} -- --publish never | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Debug: List release-builds directory" | |
| run: | | |
| echo "Contents of release-builds directory:" | |
| ls -l release-builds | |
| - name: Prepare artifacts (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| run: | | |
| mkdir -p prepared-artifacts | |
| # Handle Linux - only move installers | |
| if [[ "${{ matrix.target }}" == "linux" ]]; then | |
| if compgen -G "release-builds/*.AppImage" > /dev/null; then | |
| mv release-builds/*.AppImage prepared-artifacts/ | |
| fi | |
| if compgen -G "release-builds/*.snap" > /dev/null; then | |
| mv release-builds/*.snap prepared-artifacts/ | |
| fi | |
| fi | |
| # Handle macOS - only move installers | |
| if [[ "${{ matrix.target }}" == "mac" ]]; then | |
| if compgen -G "release-builds/*.dmg" > /dev/null; then | |
| mv release-builds/*.dmg prepared-artifacts/ | |
| fi | |
| fi | |
| shell: bash | |
| - name: Prepare artifacts (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path prepared-artifacts | Out-Null | |
| # Move all setup files (.exe, .blockmap) - only installers, no unpacked zips | |
| Get-ChildItem -Path "release-builds" -Filter "*.exe" | ForEach-Object { | |
| Move-Item $_.FullName -Destination "prepared-artifacts/" -Force | |
| } | |
| Get-ChildItem -Path "release-builds" -Filter "*.blockmap" | ForEach-Object { | |
| Move-Item $_.FullName -Destination "prepared-artifacts/" -Force | |
| } | |
| - name: Move artifacts to release directory (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| run: | | |
| mkdir -p release-artifacts | |
| if [ -d prepared-artifacts ] && [ "$(ls -A prepared-artifacts 2>/dev/null)" ]; then | |
| mv prepared-artifacts/* release-artifacts/ || true | |
| fi | |
| - name: Move artifacts to release directory (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path release-artifacts | Out-Null | |
| if (Test-Path "prepared-artifacts") { | |
| Get-ChildItem -Path "prepared-artifacts" | Move-Item -Destination "release-artifacts" -Force | |
| } | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts-${{ matrix.target }}-${{ matrix.arch }} | |
| path: | | |
| release-artifacts/*.exe | |
| release-artifacts/*.blockmap | |
| release-artifacts/*.dmg | |
| release-artifacts/*.AppImage | |
| if-no-files-found: ignore | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get version and create tag | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| TAG_NAME="v${VERSION}" | |
| TIMESTAMP=$(date +'%Y%m%d%H%M%S') | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git fetch --tags | |
| # Check if tag already exists, if so append timestamp | |
| if git ls-remote --tags origin "$TAG_NAME" 2>/dev/null | grep -q "refs/tags/$TAG_NAME"; then | |
| echo "Tag $TAG_NAME already exists. Appending timestamp." | |
| TAG_NAME="${TAG_NAME}-${TIMESTAMP}" | |
| fi | |
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
| echo "Creating tag: $TAG_NAME" | |
| git tag $TAG_NAME | |
| git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git $TAG_NAME | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-artifacts | |
| merge-multiple: true | |
| - name: Flatten artifact directory structure | |
| run: | | |
| # Move all files from subdirectories to release-artifacts root | |
| find release-artifacts -type f -exec mv {} release-artifacts/ \; | |
| # Remove empty subdirectories | |
| find release-artifacts -type d -empty -delete 2>/dev/null || true | |
| # List all files for debugging | |
| echo "Files in release-artifacts:" | |
| ls -la release-artifacts/ || echo "Directory is empty or doesn't exist" | |
| - name: Upload GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.TAG_NAME }} | |
| files: | | |
| release-artifacts/*.exe | |
| release-artifacts/*.blockmap | |
| release-artifacts/*.dmg | |
| release-artifacts/*.AppImage | |
| fail_on_unmatched_files: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |