Skip to content

Test, Build & Release #123

Test, Build & Release

Test, Build & Release #123

Workflow file for this run

name: Test, Build & Release
run-name: Test, Build & Release
permissions:
contents: write
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
lint:
name: Run ESLint
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint -- --max-warnings=0
build-windows-x64:
name: Build Windows x64
needs: [test, lint]
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run make -- --arch=x64 --appVersion=${{ github.ref_name }}
- name: Rename executables to include x64
shell: powershell
run: |
Get-ChildItem -Path "out/make/squirrel.windows/x64/*.exe" | ForEach-Object {
$newName = $_.Name -replace '\.exe$', '-x64.exe'
Rename-Item $_.FullName -NewName $newName
}
- name: List build artifacts
shell: cmd
run: dir out\make /s
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-x64-artifacts
path: |
out/make/squirrel.windows/x64/*.exe
out/make/zip/win32/x64/*.zip
build-windows-ia32:
name: Build Windows x86
needs: [test, lint]
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run make -- --arch=ia32 --appVersion=${{ github.ref_name }}
- name: Rename executables to include x86
shell: powershell
run: |
Get-ChildItem -Path "out/make/squirrel.windows/ia32/*.exe" | ForEach-Object {
$newName = $_.Name -replace '\.exe$', '-x86.exe'
Rename-Item $_.FullName -NewName $newName
}
- name: List build artifacts
shell: cmd
run: dir out\make /s
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-ia32-artifacts
path: |
out/make/squirrel.windows/ia32/*.exe
out/make/zip/win32/ia32/*.zip
build-linux-debian:
name: Build Linux (Debian)
needs: [test, lint]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run make -- --platform=linux --targets=@electron-forge/maker-deb --appVersion=${{ github.ref_name }}
- name: List build artifacts
run: find out/make -type f
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-deb-artifacts
path: out/make/deb/x64/*.deb
build-linux-arch:
name: Build Linux (Arch)
needs: [test, lint]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run make -- --platform=linux --targets=@electron-forge/maker-zip --appVersion=${{ github.ref_name }}
- name: List build artifacts
run: find out/make -type f
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-arch-artifacts
path: out/make/zip/linux/x64/*.zip
build-macos:
name: Build macOS
needs: [test, lint]
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run make -- --platform=darwin --targets=@electron-forge/maker-zip,@electron-forge/maker-dmg --appVersion=${{ github.ref_name }}
- name: List build artifacts
run: find out/make -type f
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macos-artifacts
path: |
out/make/zip/darwin/x64/*.zip
out/make/*.dmg
create-release:
name: Create Release
needs:
[
build-windows-x64,
build-windows-ia32,
build-linux-debian,
build-linux-arch,
build-macos,
]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display tag information
run: echo "Creating release for tag ${{ github.ref_name }}"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/windows-x64-artifacts/**
artifacts/windows-ia32-artifacts/**
artifacts/linux-deb-artifacts/**
artifacts/linux-arch-artifacts/**
artifacts/macos-artifacts/**
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, '-pre') }}
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}