Skip to content

Alpha 30 RC-4

Alpha 30 RC-4 #74

Workflow file for this run

name: Build ArduDeck
on:
release:
types: [created]
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag to upload artifacts to (e.g. v0.0.2-alpha). Leave empty for build-only.'
required: false
type: string
permissions:
contents: write
env:
NODE_VERSION: '20'
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: |
# Derive version from git tag when available, otherwise fall back to package.json
if [ "${{ github.event_name }}" = "release" ]; then
TAG="${{ github.event.release.tag_name }}"
elif [ -n "${{ inputs.release_tag }}" ]; then
TAG="${{ inputs.release_tag }}"
fi
if [ -n "$TAG" ]; then
# Strip leading 'v' from tag: v0.0.28-rc-3 → 0.0.28-rc-3
VERSION="${TAG#v}"
else
VERSION=$(node -p "require('./package.json').version")
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "BUILD_NAME=ArduDeck-${VERSION}-linux" >> $GITHUB_ENV
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libusb-1.0-0-dev
- name: Install dependencies
run: pnpm install
- name: Sync version to desktop app
run: |
node -e "
const fs = require('fs');
const root = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
root.version = '${{ env.VERSION }}';
fs.writeFileSync('./package.json', JSON.stringify(root, null, 2) + '\n');
const desktop = JSON.parse(fs.readFileSync('./apps/desktop/package.json', 'utf8'));
desktop.version = '${{ env.VERSION }}';
fs.writeFileSync('./apps/desktop/package.json', JSON.stringify(desktop, null, 2) + '\n');
"
- name: Build packages
run: pnpm build
- name: Build Linux x64
working-directory: apps/desktop
run: pnpm package --linux --publish never
- name: Upload Linux AppImage
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-AppImage
path: apps/desktop/release/*.AppImage
- name: Upload Linux deb
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-deb
path: apps/desktop/release/*.deb
- name: Upload Linux update metadata
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-meta
path: |
apps/desktop/release/*.yml
apps/desktop/release/*.blockmap
build-mac-arm64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: |
if [ "${{ github.event_name }}" = "release" ]; then
TAG="${{ github.event.release.tag_name }}"
elif [ -n "${{ inputs.release_tag }}" ]; then
TAG="${{ inputs.release_tag }}"
fi
if [ -n "$TAG" ]; then
VERSION="${TAG#v}"
else
VERSION=$(node -p "require('./package.json').version")
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "BUILD_NAME=ArduDeck-${VERSION}-mac-arm64" >> $GITHUB_ENV
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
# Workaround for node-gyp issues on macOS
- name: Install Python setuptools
run: python3 -m pip install --break-system-packages setuptools || python3 -m pip install setuptools
- name: Install dependencies
run: pnpm install
- name: Sync version to desktop app
run: |
node -e "
const fs = require('fs');
const root = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
root.version = '${{ env.VERSION }}';
fs.writeFileSync('./package.json', JSON.stringify(root, null, 2) + '\n');
const desktop = JSON.parse(fs.readFileSync('./apps/desktop/package.json', 'utf8'));
desktop.version = '${{ env.VERSION }}';
fs.writeFileSync('./apps/desktop/package.json', JSON.stringify(desktop, null, 2) + '\n');
"
- name: Build packages
run: pnpm build
- name: Build macOS arm64
working-directory: apps/desktop
run: pnpm package --mac --arm64 --publish never
- name: Upload macOS arm64 dmg
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-dmg
path: apps/desktop/release/*.dmg
- name: Upload macOS arm64 zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-zip
path: apps/desktop/release/*.zip
- name: Upload macOS update metadata
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-meta
path: |
apps/desktop/release/*.yml
apps/desktop/release/*.blockmap
build-mac-x64:
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: |
if [ "${{ github.event_name }}" = "release" ]; then
TAG="${{ github.event.release.tag_name }}"
elif [ -n "${{ inputs.release_tag }}" ]; then
TAG="${{ inputs.release_tag }}"
fi
if [ -n "$TAG" ]; then
VERSION="${TAG#v}"
else
VERSION=$(node -p "require('./package.json').version")
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "BUILD_NAME=ArduDeck-${VERSION}-mac-x64" >> $GITHUB_ENV
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
# Workaround for node-gyp issues on macOS
- name: Install Python setuptools
run: python3 -m pip install --break-system-packages setuptools || python3 -m pip install setuptools
- name: Install dependencies
run: pnpm install
- name: Sync version to desktop app
run: |
node -e "
const fs = require('fs');
const root = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
root.version = '${{ env.VERSION }}';
fs.writeFileSync('./package.json', JSON.stringify(root, null, 2) + '\n');
const desktop = JSON.parse(fs.readFileSync('./apps/desktop/package.json', 'utf8'));
desktop.version = '${{ env.VERSION }}';
fs.writeFileSync('./apps/desktop/package.json', JSON.stringify(desktop, null, 2) + '\n');
"
- name: Build packages
run: pnpm build
- name: Build macOS x64
working-directory: apps/desktop
run: pnpm package --mac --x64 --publish never
- name: Upload macOS x64 dmg
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-dmg
path: apps/desktop/release/*.dmg
- name: Upload macOS x64 zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-zip
path: apps/desktop/release/*.zip
- name: Rename x64 metadata to avoid collision with arm64
working-directory: apps/desktop/release
run: |
for f in latest*.yml; do
[ -f "$f" ] && mv "$f" "${f%.yml}-x64.yml"
done
- name: Upload macOS update metadata
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-meta
path: |
apps/desktop/release/*.yml
apps/desktop/release/*.blockmap
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
shell: bash
run: |
if [ "${{ github.event_name }}" = "release" ]; then
TAG="${{ github.event.release.tag_name }}"
elif [ -n "${{ inputs.release_tag }}" ]; then
TAG="${{ inputs.release_tag }}"
fi
if [ -n "$TAG" ]; then
VERSION="${TAG#v}"
else
VERSION=$(node -p "require('./package.json').version")
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "BUILD_NAME=ArduDeck-${VERSION}-win" >> $GITHUB_ENV
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Sync version to desktop app
shell: bash
run: |
node -e "
const fs = require('fs');
const root = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
root.version = '${{ env.VERSION }}';
fs.writeFileSync('./package.json', JSON.stringify(root, null, 2) + '\n');
const desktop = JSON.parse(fs.readFileSync('./apps/desktop/package.json', 'utf8'));
desktop.version = '${{ env.VERSION }}';
fs.writeFileSync('./apps/desktop/package.json', JSON.stringify(desktop, null, 2) + '\n');
"
- name: Build packages
run: pnpm build
- name: Build Windows x64
working-directory: apps/desktop
run: pnpm package --win --x64 --publish never
- name: Upload Windows installer
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-installer
path: apps/desktop/release/*.exe
- name: Upload Windows portable
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-portable
path: apps/desktop/release/*portable*.exe
- name: Upload Windows update metadata
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_NAME }}-meta
path: |
apps/desktop/release/*.yml
apps/desktop/release/*.blockmap
# Upload artifacts to a release
release:
needs: [build-linux, build-mac-arm64, build-mac-x64, build-windows]
runs-on: ubuntu-latest
if: github.event_name == 'release' || inputs.release_tag != ''
permissions:
contents: write
steps:
- name: Determine release tag
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
else
echo "TAG=${{ inputs.release_tag }}" >> $GITHUB_ENV
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display artifacts
run: ls -R artifacts
- name: Upload artifacts to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--clobber \
artifacts/**/*.AppImage \
artifacts/**/*.deb \
artifacts/**/*.dmg \
artifacts/**/*.zip \
artifacts/**/*.exe \
artifacts/**/latest*.yml \
artifacts/**/*.blockmap