Skip to content

Linuxビルドエラー修正 #117

Linuxビルドエラー修正

Linuxビルドエラー修正 #117

name: Build and Draft Release
# Only runs
# - after PRs have been merged into master
# - when a user specifically requests the workflow to run on a branch
on:
workflow_dispatch:
push:
branches: [master]
jobs:
checkversion:
name: Check if version has corrosponding tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
commits: ${{ steps.commits.outputs.commits }}
template: ${{ steps.template.outputs.template }}
dobuild: ${{ steps.dobuild.outputs.dobuild }}
steps:
- name: Checkout nmori/firebot
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read package.json
id: package
uses: gregoranders/nodejs-project-info@v0.0.21
- name: Retrieve package.json version
id: version
run: echo "version=${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT
- name: Get commit messages
id: commits
shell: bash
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
RES=$(git log --pretty=format:'- %s' --branches=origin/v5 $(git describe --tags `git rev-list --tags --max-count=1`)..HEAD)
echo "commits<<${EOF}" >> $GITHUB_OUTPUT
echo "${RES}" >> $GITHUB_OUTPUT
echo "${EOF}" >> $GITHUB_OUTPUT
- name: Read Release Template
id: template
shell: bash
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
TEMPLATE=`cat './.github/release-template.md'`
echo "template<<${EOF}" >> $GITHUB_OUTPUT
echo "${TEMPLATE}" >> $GITHUB_OUTPUT
echo "${EOF}" >> $GITHUB_OUTPUT
- name: "Check: package version has corrosponding git tag"
id: dobuild
shell: bash
run: echo dobuild=$(git show-ref --tags --verify --quiet -- "refs/tags/v${{ steps.version.outputs.version }}" && echo 0 || echo 1) >> $GITHUB_OUTPUT
compile:
name: "Compile"
needs: [checkversion]
if: needs.checkversion.outputs.dobuild == 1
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Python deps
run: python -m pip install --upgrade packaging pip setuptools
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
# Node was bumped 20.14.0 -> 22 -> 24 on 2026-05-23, which is when the Linux/Windows
# packaging started exiting 0 mid-extract (@electron/packager's extract-zip stops at the
# first electron-runtime zip entry on those runners, leaving an empty pack dir). macOS
# packs fine on 24, so keep it there; pin the affected runners back to the pre-bump LTS.
node-version: ${{ runner.os == 'macOS' && '24.x' || '20.x' }}
- name: Install correct npm version
run: npm install -g npm@10.8.1
- name: Linux Build Prep
if: runner.os == 'linux'
run: |
sudo apt-get update
sudo apt-get install libx11-dev libxtst-dev libpng-dev
- name: MacOS Build Prep
if: runner.os == 'macOS'
# appdmg will fail to install without python setuptools since gh runners now use python 3.12. See: https://github.com/electron/forge/issues/3371
run: brew install python-setuptools
- name: Install Global Dependencies
run: npm install --global grunt-cli node-gyp
- name: Install Project Dependencies
run: npm install --include=optional
- name: Decrypt Secrets.gpg
env:
PASSKEY_FOR_FIREBOT_SECRETS: ${{ secrets.PASSKEY_FOR_FIREBOT_SECRETS }}
run: grunt secrets:decrypt
- name: Build for Platform
run: grunt build
- name: Verify macOS arm64 DMG symlinks
if: runner.os == 'macOS'
shell: bash
run: |
# Informational post-build check of the already-built arm64 .dmg. It must NOT fail the
# release: the .dmg is the real artifact, and `hdiutil attach/detach` + readlink under the
# default `-e -o pipefail` shell are flaky on the runner (a "resource busy" detach or a
# transient mount would abort an otherwise-good build). `set +e` + `exit 0` keep it advisory
# while still logging the symlink state (a ⚠ is printed if they look wrong).
set +e
DMG=$(ls ./dist/install/darwin/firebot-v*-macos-arm64.dmg 2>/dev/null || echo "")
if [ -z "$DMG" ]; then
echo "arm64 DMG not found - skipping verification"
exit 0
fi
MOUNT=$(hdiutil attach -nobrowse -readonly "$DMG" | tail -1 | awk '{for(i=3;i<=NF;++i) printf "%s%s", $i, (i<NF?" ":""); print ""}')
FW="$MOUNT/Firebot.app/Contents/Frameworks/Electron Framework.framework"
CUR=$(readlink "$FW/Versions/Current")
EF=$(readlink "$FW/Electron Framework")
echo "arm64 - Versions/Current -> $CUR"
echo "arm64 - Electron Framework -> $EF"
hdiutil detach "$MOUNT" || hdiutil detach "$MOUNT" -force || true
if [ "$CUR" = "A" ] && [ "$EF" = "Versions/Current/Electron Framework" ]; then
echo "✓ arm64 DMG symlinks verified successfully"
else
echo "⚠ arm64 DMG symlinks unexpected (Versions/Current='$CUR', Electron Framework='$EF') - reporting only, not failing the build"
fi
exit 0
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}
path: ./dist/install/${{ runner.os == 'macOS' && 'darwin' || runner.os }}/
draft:
name: Draft Github Release
needs: [checkversion, compile]
if: needs.checkversion.outputs.dobuild == 1
runs-on: ubuntu-latest
steps:
- name: Download Compilation Artifacts
uses: actions/download-artifact@v4
with:
path: ./bundles/
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ env.GITHUB_TOKEN }}
draft: true
prerelease: false
tag_name: v${{ needs.checkversion.outputs.version }}
name: Release v${{ needs.checkversion.outputs.version }}
body: ${{ format(needs.checkversion.outputs.template, needs.checkversion.outputs.version, needs.checkversion.outputs.commits) }}
generate_release_notes: false
files: |
./bundles/Windows/firebot-v${{ needs.checkversion.outputs.version }}-setup.exe
./bundles/Windows/firebot-${{ needs.checkversion.outputs.version }}-full.nupkg
./bundles/Windows/RELEASES
./bundles/Linux/firebot-v${{ needs.checkversion.outputs.version }}-linux-x64.tar.gz
./bundles/Linux/firebot-v${{ needs.checkversion.outputs.version }}-linux-x64.deb
./bundles/Linux/firebot-v${{ needs.checkversion.outputs.version }}-linux-x64.rpm
./bundles/macOS/firebot-v${{ needs.checkversion.outputs.version }}-macos-x64.dmg
./bundles/macOS/firebot-v${{ needs.checkversion.outputs.version }}-macos-arm64.dmg