version bump #110
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*.*.*' | |
| paths-ignore: | |
| - '**.md' | |
| - '**.spec.js' | |
| - '.idea' | |
| - '.vscode' | |
| - '.dockerignore' | |
| - 'Dockerfile' | |
| - '.gitignore' | |
| - '.github/**' | |
| - '!.github/workflows/build.yml' | |
| jobs: | |
| build: | |
| name: Build for ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| environment: Prod | |
| strategy: | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| - name: Set up Python (for native modules) | |
| uses: actions/setup-python@v5 | |
| id: setup_python | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python build tools | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| # Ensure distutils is available for node-gyp | |
| python -c "import distutils; print('distutils available')" | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| cache-dependency-path: backend/go.sum | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Verify Go installation | |
| run: | | |
| which go | |
| go version | |
| - name: Install Go Dependencies | |
| working-directory: backend | |
| run: go mod download | |
| - name: Install Node Dependencies | |
| run: npm install | |
| env: | |
| PYTHON: ${{ steps.setup_python.outputs.python-path }} | |
| npm_config_python: ${{ steps.setup_python.outputs.python-path }} | |
| - name: Run Unit Tests | |
| run: npm run test | |
| - name: Get app version from package.json | |
| id: get_version | |
| run: echo "APP_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Create app-config.json | |
| shell: bash | |
| run: | | |
| printf "{\n" > app-config.json | |
| printf " \"VITE_GOOGLE_CLIENT_ID\": \"%s\",\n" "${{ secrets.VITE_GOOGLE_CLIENT_ID }}" >> app-config.json | |
| printf " \"VITE_GOOGLE_CLIENT_SECRET\": \"%s\"\n" "${{ secrets.VITE_GOOGLE_CLIENT_SECRET }}" >> app-config.json | |
| printf "}\n" >> app-config.json | |
| env: | |
| VITE_GOOGLE_CLIENT_ID: ${{ secrets.VITE_GOOGLE_CLIENT_ID }} | |
| VITE_GOOGLE_CLIENT_SECRET: ${{ secrets.VITE_GOOGLE_CLIENT_SECRET }} | |
| - name: Create resources directory | |
| run: mkdir -p resources/backend | |
| shell: bash | |
| - name: Install build dependencies | |
| run: | | |
| if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential | |
| elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| # Windows has build tools available by default | |
| echo "Using Windows build tools" | |
| elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
| # macOS has build tools available via Xcode Command Line Tools | |
| echo "Using macOS build tools" | |
| fi | |
| shell: bash | |
| - name: Build Go Backend and Download Models | |
| run: npm run build:go | |
| shell: bash | |
| - name: Build Release Files | |
| run: npm run build:web && npx electron-builder --publish never | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Release Artifacts for ${{ matrix.os }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-artifacts-${{ matrix.os }} | |
| path: release/${{ env.APP_VERSION }} | |
| if-no-files-found: error | |
| retention-days: 5 | |
| create_release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Download all release assets | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./release-assets | |
| pattern: release-artifacts-* | |
| merge-multiple: true | |
| - name: Display structure of downloaded files | |
| shell: bash | |
| run: | | |
| echo "Downloaded release assets:" | |
| ls -R ./release-assets | |
| - name: Create GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: './release-assets/*' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| generateReleaseNotes: true | |
| prerelease: ${{ contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'rc') }} |