Skip to content

Remove duplicate bundle compilation in CI #453

Remove duplicate bundle compilation in CI

Remove duplicate bundle compilation in CI #453

Workflow file for this run

name: Build
on:
push:
pull_request:
jobs:
compile:
name: Check & Compile
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
- name: Install Node.js dependencies
run: npm ci --ignore-scripts
- name: Check formatting
run: npm run check-format
- name: Compile bundles
run: npm run compile
- name: Upload bundles
uses: actions/upload-artifact@v3
with:
name: bundles
path: bundles/*.js
build:
strategy:
matrix:
platform:
- { displayName: "macOS", os: macos-latest, shortName: "mac", buildArg: "-m", artifactExt: "dmg" }
- { displayName: "Windows", os: windows-latest, shortName: "win", buildArg: "-w", artifactExt: "exe" }
- { displayName: "Linux/deb", os: ubuntu-latest, shortName: "linux", buildArg: "-l deb", artifactExt: "deb" }
- {
displayName: "Linux/snap",
os: ubuntu-latest,
shortName: "linux",
buildArg: "-l snap",
artifactExt: "snap"
}
- {
displayName: "Linux/AppImage",
os: ubuntu-latest,
shortName: "linux",
buildArg: "-l AppImage",
artifactExt: "AppImage"
}
arch: ["x64", "arm64"]
exclude:
- arch: arm64
platform: { displayName: "Linux/snap", os: ubuntu-latest, shortName: "linux", artifactExt: "snap" }
name: Build for ${{ matrix.platform.displayName }} (${{ matrix.arch }})
runs-on: ${{ matrix.platform.os }}
needs: compile
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
- name: Install Node.js dependencies
run: npm ci
- name: Install Linux dependencies
if: matrix.platform.os == 'ubuntu-latest'
run: sudo apt-get update; sudo apt-get install --no-install-recommends -y libarchive-tools snapcraft
- name: Prepare macOS certificate
if: matrix.platform.os == 'macos-latest' && github.event_name == 'push'
run: |
echo "CSC_LINK=${{ secrets.MACOS_CERTIFICATE }}" >> $GITHUB_ENV
echo "CSC_KEY_PASSWORD=${{ secrets.MACOS_CERTIFICATE_PWD }}" >> $GITHUB_ENV
- name: Download bundles
uses: actions/download-artifact@v3
with:
name: bundles
path: bundles
- name: Build app
run: npx electron-builder build --${{ matrix.arch }} ${{ matrix.platform.buildArg }} --publish never
env:
NODE_OPTIONS: --max-old-space-size=4096
- name: Prepare macOS artifact
if: matrix.platform.os == 'macos-latest'
run: |
mv dist/AdvantageScope-*.dmg advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}
- name: Prepare Linux artifact
if: matrix.platform.os == 'ubuntu-latest'
run: |
mv dist/*.${{ matrix.platform.artifactExt }} advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}
- name: Prepare Windows artifact
if: matrix.platform.os == 'windows-latest'
run: |
Move-Item -Path "dist\AdvantageScope*.exe" -Destination "advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}
path: advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}