more node modules #56
  
    
      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 Electron App | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| check_version: | |
| name: Check Package Version and Tag Existence | |
| runs-on: ubuntu-latest | |
| outputs: | |
| package_version: ${{ steps.get_version.outputs.version }} | |
| tag_exists: ${{ steps.check_tag.outputs.tag_exists }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| - name: Get package.json version | |
| id: get_version | |
| run: | | |
| version=$(node -p "require('./package.json').version") | |
| echo "Package version is $version" | |
| echo "::set-output name=version::$version" | |
| - name: Fetch All Tags | |
| run: git fetch --tags | |
| - name: Check if Tag Exists | |
| id: check_tag | |
| env: | |
| PACKAGE_VERSION: ${{ steps.get_version.outputs.version }} | |
| run: | | |
| if git tag --list "v$PACKAGE_VERSION" | grep -q "v$PACKAGE_VERSION"; then | |
| echo "Tag v$PACKAGE_VERSION exists." | |
| echo "::set-output name=tag_exists::true" | |
| else | |
| echo "Tag v$PACKAGE_VERSION does not exist." | |
| echo "::set-output name=tag_exists::false" | |
| fi | |
| release: | |
| name: Publish Electron App | |
| needs: check_version | |
| if: needs.check_version.outputs.tag_exists == 'false' | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| # Use the package version without the v prefix if necessary | |
| VERSION: ${{ needs.check_version.outputs.package_version }} | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| GITHUB_RELEASE_TOKEN: ${{ secrets.GH_TOKEN }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| - name: Install Dependencies | |
| run: npm ci --no-audit | |
| env: | |
| CI: true | |
| - name: Build | |
| run: npm run build:electron | |
| env: | |
| CI: true | |
| - name: Build Electron App for macOS | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| echo "Building for macOS (arm64)..." | |
| npm run build:electron:mac | |
| - name: Build Electron App for Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| echo "Building for Windows (x64)..." | |
| npm run build:electron:win | |
| - name: Build Electron App for Linux | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| echo "Building for Linux (x64)..." | |
| npm run build:electron:linux | |