Add permission for build process to write to repository #7
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 Differon | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| # Grant permissions to the workflow | |
| permissions: | |
| contents: write # Needed to create releases | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest, macos-latest, ubuntu-latest] | |
| fail-fast: false # Don't cancel other jobs if one fails | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install dependencies | |
| run: npm install | |
| # macOS specific: Skip setuptools installation (not needed for dmg) | |
| # - name: Install macOS build tools | |
| # if: matrix.os == 'macos-latest' | |
| # run: | | |
| # python3 -m pip install setuptools | |
| # Linux specific: Install required packages | |
| - name: Install Linux build tools | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y rpm fakeroot dpkg | |
| - name: Build Electron app | |
| run: npm run dist | |
| env: | |
| # Disable code signing for macOS in CI | |
| CSC_IDENTITY_AUTO_DISCOVERY: false | |
| # Debug: List what was built | |
| - name: List dist contents | |
| run: | | |
| echo "Contents of dist folder:" | |
| ls -la dist/ || echo "dist folder not found" | |
| shell: bash | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() # Upload even if previous steps failed | |
| with: | |
| name: ${{ matrix.os }}-installer | |
| path: | | |
| dist/*.exe | |
| dist/*.msi | |
| dist/*.dmg | |
| dist/*.AppImage | |
| dist/*.deb | |
| dist/*.rpm | |
| dist/*.snap | |
| dist/*.blockmap | |
| if-no-files-found: warn # Warn instead of error if no files found | |
| retention-days: 5 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: always() # Run even if some builds failed | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: installers | |
| # Debug: Show what artifacts we have | |
| - name: Display structure of downloaded files | |
| run: ls -R installers/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| draft: true | |
| files: | | |
| installers/**/*.exe | |
| installers/**/*.dmg | |
| installers/**/*.AppImage | |
| installers/**/*.deb | |
| fail_on_unmatched_files: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |