Update build.yml #58
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 }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '16' | |
| - name: Cache Yarn | |
| id: yarn-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/AppData/Local/Yarn/Cache | |
| ~/AppData/Roaming/npm-cache | |
| ~/.yarn | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| - name: Install Yarn | |
| run: npm install -g yarn && yarn config set ignore-engines true | |
| - name: Cache node_modules | |
| id: node-modules-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-modules- | |
| - name: Install dependencies | |
| if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
| run: npx yarn install | |
| - name: Install snapcraft | |
| if: runner.os == 'Linux' | |
| run: sudo snap install snapcraft --classic | |
| - name: Add tar to PATH | |
| if: runner.os == 'Linux' | |
| run: echo "$(dirname "$(which tar)")" >> $GITHUB_PATH | |
| - name: Add snap to PATH | |
| if: runner.os == 'Linux' | |
| run: echo "/snap/bin" >> $GITHUB_PATH | |
| - name: Run build script on Linux | |
| if: runner.os == 'Linux' | |
| run: npx yarn dist | |
| env: | |
| PATH: ./node_modules/.bin:$PATH | |
| - name: Run build script on Windows | |
| if: runner.os == 'Windows' | |
| run: build.bat | |
| env: | |
| PATH: ./node_modules/.bin:$PATH | |
| - 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: Archive .exe files | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Windows Installer Files | |
| path: dist/*.exe | |
| - name: Archive .zip files | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Windows Portable Files | |
| path: dist/*.zip | |
| - name: Archive .snap files | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Linux Installer Files | |
| path: dist/*.snap |