Add support for multiple linux platforms #117
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-13] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '16' | |
| - name: Cache node_modules | |
| id: node-modules-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-modules- | |
| - name: Install dependencies | |
| if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
| run: npm install | |
| - name: Cache snapcraft | |
| if: runner.os == 'Linux' | |
| id: snapcraft-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: /var/lib/snapd/snaps | |
| key: ${{ runner.os }}-snapcraft-${{ hashFiles('**/snapcraft.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-snapcraft- | |
| - name: Install Snapcraft | |
| if: steps.snapcraft-cache.outputs.cache-hit != 'true' && runner.os == 'Linux' | |
| run: | | |
| sudo snap install snapcraft --classic | |
| - name: Add tar and snap to PATH | |
| if: runner.os == 'Linux' | |
| run: echo "$(dirname "$(which tar)")" >> $GITHUB_PATH && echo "/snap/bin" >> $GITHUB_PATH | |
| - name: Cache Electron binaries | |
| id: electron-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/electron | |
| ~/.cache/electron-builder | |
| ~/AppData/Local/electron | |
| ~/AppData/Local/electron-builder | |
| key: ${{ runner.os }}-electron-${{ hashFiles('package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-electron- | |
| - name: Run build script on Linux and MacOS | |
| if: runner.os == 'Linux' || runner.os == 'macOS' | |
| run: yarn dist | |
| env: | |
| PATH: ./node_modules/.bin:$PATH | |
| - name: Run build script on Windows | |
| if: runner.os == 'Windows' | |
| run: npx yarn dist | |
| - name: Zip portable builds | |
| if: runner.os == 'Windows' | |
| run: Compress-Archive -Path .\dist\win-unpacked\* -DestinationPath .\dist\Sploder-Portable-x64.zip && Compress-Archive -Path .\dist\win-ia32-unpacked\* -DestinationPath .\dist\Sploder-Portable-ia32.zip | |
| - name: Upload .exe files | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Windows Installer Files | |
| path: dist/*.exe | |
| - name: Upload .zip files | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Windows Portable Files | |
| path: dist/*.zip | |
| - name: Upload .app files | |
| if: runner.os == 'macOS' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macOS Portable Files | |
| path: dist/mac | |
| - name: Upload .snap files | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux Snap Files | |
| path: dist/*.snap | |
| - name: Upload .deb files | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux deb Files | |
| path: dist/*.deb | |
| - name: Upload .rpm files | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux rpm Files | |
| path: dist/*.rpm | |
| - name: Upload .AppImage files | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux AppImage Files | |
| path: dist/*.AppImage | |
| - name: Upload .zip files | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux Portable Files | |
| path: dist/linux-unpacked |