Skip to content

chore: fix release and macos code sign #15

chore: fix release and macos code sign

chore: fix release and macos code sign #15

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
jobs:
build-artifacts:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-15-intel
platform: darwin
arch: x64
artifact_name: darwin-x64
- os: macos-latest
platform: darwin
arch: arm64
artifact_name: darwin-arm64
- os: windows-latest
platform: win32
arch: x64
artifact_name: win32-x64
- os: windows-11-arm
platform: win32
arch: arm64
artifact_name: win32-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache Node Modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
shell: bash
run: |
if [ -d "node_modules" ]; then
echo "node_modules exists"
else
npm ci
fi
- name: Build application
run: npm run build
- name: Build for ${{ matrix.platform }}-${{ matrix.arch }}
run: npm run pack
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Adhoc codesign app (mac only)
if: matrix.platform == 'darwin'
run: |
APP_PATH=$(find release -name "*.app" -type d | head -1)
codesign --force --deep --sign - --options runtime "$APP_PATH"
codesign -dv "$APP_PATH"
- name: List build artifacts
shell: bash
run: |
echo "Build artifacts:"
if echo "${{ matrix.os }}" | grep -qi "windows"; then
powershell -Command "if (-Not (Test-Path 'release')) { echo 'No release directory found' }"
powershell -Command "if (Test-Path 'release\\*.exe') { Get-ChildItem 'release\\*.exe' -Recurse } else { echo 'No .exe files found' }"
powershell -Command "if (Test-Path 'release\\*.zip') { Get-ChildItem 'release\\*.zip' -Recurse } else { echo 'No .zip files found' }"
else
ls -la release/ || echo "No release directory found"
find release/ -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.AppImage" \) || echo "No build artifacts found"
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}-${{ github.ref_name }}
path: |
release/*.dmg
release/*.exe
release/*.zip
release/*.AppImage
retention-days: 30
create-release:
needs: build-artifacts
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get tag information
id: tag_info
run: |
TAG_MESSAGE=$(git for-each-ref refs/tags/${{ github.ref_name }} --format='%(contents)' | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | sed -e '/./,$!d')
if [ -n "$TAG_MESSAGE" ]; then
echo "tag_message<<EOF" >> $GITHUB_OUTPUT
echo "$TAG_MESSAGE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "tag_message=No description provided for this tag." >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
files: |
artifacts/darwin-x64-${{ github.ref_name }}/*
artifacts/darwin-arm64-${{ github.ref_name }}/*
artifacts/win32-x64-${{ github.ref_name }}/*
artifacts/win32-arm64-${{ github.ref_name }}/*
body: |
${{ steps.tag_info.outputs.tag_message }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}