Skip to content

fix: more error handling #32

fix: more error handling

fix: more error handling #32

Workflow file for this run

name: Build
on:
push:
tags:
- v**
jobs:
build-frontend:
name: Build snd-frontend
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install Frontend Dependencies
working-directory: frontend
run: npm ci
- name: Build Frontend
working-directory: frontend
run: npm run build
- name: Archive Frontend
uses: actions/upload-artifact@v4
with:
name: snd-frontend
path: frontend/dist
if-no-files-found: error
build-linux-app:
name: Build ${{ matrix.artifact-name }}
runs-on: ubuntu-latest
needs: build-frontend
strategy:
matrix:
include:
# ELECTRON
- arch: "amd64"
tags: "ELECTRON"
artifact-name: "snd-linux-amd64-gui"
- arch: "amd64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-linux-amd64-gui-libusb"
# HEADLESS
- arch: "amd64"
artifact-name: "snd-linux-amd64-headless"
- arch: "arm64"
artifact-name: "snd-linux-arm64-headless"
- arch: "386"
artifact-name: "snd-linux-i386-headless"
- arch: "arm"
armv: "5"
artifact-name: "snd-linux-armv5-headless"
- arch: "arm"
armv: "6"
artifact-name: "snd-linux-armv6-headless"
- arch: "arm"
armv: "7"
artifact-name: "snd-linux-armv7-headless"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install libusb
if: matrix.libusb
run: sudo apt-get install libusb-1.0-0-dev pkg-config && pkg-config --cflags libusb-1.0
- name: Build App
uses: ./.github/actions/build-app
with:
os: linux
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
build-windows-app:
name: Build ${{ matrix.artifact-name }}
runs-on: windows-latest
needs: build-frontend
strategy:
matrix:
include:
# ELECTRON
- arch: "amd64"
libusb: false
tags: "ELECTRON"
artifact-name: "snd-windows"
- arch: "amd64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-windows-libusb"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Prepare libusb
if: matrix.libusb
uses: msys2/setup-msys2@v2
with:
path-type: inherit # needs access to other executables like go
install: git mingw-w64-x86_64-cc mingw-w64-x86_64-pkg-config mingw-w64-x86_64-libusb
- name: Check for libusb
if: matrix.libusb
shell: msys2 {0}
run: |
pkg-config --cflags libusb-1.0
pkg-config --libs libusb-1.0
ls D:/a/_temp/msys64/mingw64/bin/libusb-1.0.dll
- name: Build App
uses: ./.github/actions/build-app
with:
os: windows
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
libusb-path: ${{ matrix.libusb && 'D:/a/_temp/msys64/mingw64/bin/libusb-1.0.dll' || null }}
# macOS AMD64
build-darwin-amd64-app:
name: Build ${{ matrix.artifact-name }}
runs-on: macos-12
needs: build-frontend
strategy:
matrix:
include:
- arch: "amd64"
tags: "ELECTRON"
artifact-name: "snd-macos-intel"
mac-app-bundle: "true"
- arch: "amd64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-macos-intel-libusb"
mac-app-bundle: "true"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install libusb
if: matrix.libusb
run: brew install libusb pkg-config && pkg-config --cflags libusb-1.0
- name: Build App
uses: ./.github/actions/build-app
with:
os: darwin
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
# macOS ARM64 (m1, m2, m3, mX)
build-darwin-arm64-app:
name: Build ${{ matrix.artifact-name }}
runs-on: macos-14
needs: build-frontend
strategy:
matrix:
include:
- arch: "arm64"
tags: "ELECTRON"
artifact-name: "snd-macos-m1"
mac-app-bundle: "true"
- arch: "arm64"
libusb: true
tags: "ELECTRON LIBUSB"
artifact-name: "snd-macos-m1-libusb"
mac-app-bundle: "true"
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Install libusb
if: matrix.libusb
run: brew install libusb pkg-config && pkg-config --cflags libusb-1.0
- name: Build App
uses: ./.github/actions/build-app
with:
os: darwin
arch: ${{ matrix.arch }}
tags: ${{ matrix.tags }}
artifact-name: ${{ matrix.artifact-name }}
create-release:
runs-on: ubuntu-latest
needs: [build-linux-app, build-windows-app, build-darwin-amd64-app, build-darwin-arm64-app]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: build/release
- name: Check release files
run: ls -hal build/release/
# Fix for https://github.com/actions/upload-artifact/issues/38
- name: Change Permissions
run: |
find build/release -type f -name 'snd' -exec chmod +x {} \;
find build/release -type f -name 'Sales & Dungeons' -exec chmod +x {} \;
- name: Zip release folders
run: cd build/release && { for i in */; do zip -r "${i%/}.zip" "$i"; done }
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: false
fail_on_unmatched_files: true
files: build/release/*.zip
release-itch:
permissions: write-all
name: release itch
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Download Release
uses: robinraju/release-downloader@v1
with:
repository: "BigJk/snd"
tag: ${{ github.ref_name }}
fileName: "*.zip"
- name: Install Butler
run: |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
rm butler.zip
./butler -V
- name: Push to Itch.io
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
run: |
./butler push snd-windows-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:windows-amd64 --userversion ${{ github.ref_name }}
./butler push snd-macos-m1-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:macos-m1 --userversion ${{ github.ref_name }}
./butler push snd-macos-intel-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:macos-intel --userversion ${{ github.ref_name }}
./butler push snd-linux-amd64-gui-libusb-${{ github.ref_name }}.zip BigJk/sales-n-dungeons:linux-amd64 --userversion ${{ github.ref_name }}