chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:46:20 +08:00
commit eb21b65815
830 changed files with 113645 additions and 0 deletions
@@ -0,0 +1,24 @@
name: Trigger Website Update
on:
release:
types: [published]
workflow_dispatch:
jobs:
trigger-website-update:
runs-on: ubuntu-latest
environment: build
strategy:
matrix:
repository:
- electerm/electerm.org
- electerm/repos
- electerm/electerm-data-tool
steps:
- name: Trigger ${{ matrix.repository }} repository workflow
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT_REPO_TOKEN }}
repository: ${{ matrix.repository }}
event-type: electerm-release
@@ -0,0 +1,26 @@
name: electerm-react-publish
on:
release:
types: [published]
push:
branches: [ electerm-react ]
jobs:
release-npm:
runs-on: ubuntu-24.04
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip npm]') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node and npm
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: https://registry.npmjs.org/
- run: npm config set legacy-peer-deps true
- run: npm install shelljs
- run: npm install -g @jsdevtools/npm-publish
- name: build
env:
token: ${{secrets.NPM_TOKEN}}
run: node build/bin/publish-electerm-react.js
+99
View File
@@ -0,0 +1,99 @@
# Simplified workflow using custom electerm-builder Docker image
name: linux-arm-legacy-docker
on:
push:
branches: [ build, test, build-only, linux-arm-legacy, legacy-build ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04-arm
container: zxdong262/electerm-builder-legacy:latest # This will be our custom image
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip legacy]') && !contains(github.event.head_commit.message, '[skip linux-arm-legacy]') }}
steps:
- name: Clone repository to /tmp and setup
run: |
cd /tmp
git clone https://github.com/electerm/electerm.git electerm_build
cd electerm_build
git checkout ${{ github.sha }}
# Configure npm to use /tmp for cache and global packages
mkdir -p /tmp/.npm /tmp/.npm-global
npm config set cache /tmp/.npm
npm config set prefix /tmp/.npm-global
export PATH="/tmp/.npm-global/bin:$PATH"
echo "PATH=/tmp/.npm-global/bin:$PATH" >> $GITHUB_ENV
echo "npm_config_cache=/tmp/.npm" >> $GITHUB_ENV
echo "npm_config_prefix=/tmp/.npm-global" >> $GITHUB_ENV
- name: Verify pre-installed versions
working-directory: /tmp/electerm_build
run: |
echo "=== Pre-installed versions ==="
node --version
npm --version
yarn --version
python3 --version
python --version
gcc --version
g++ --version
fpm --version
- name: Clear electron-builder cache
working-directory: /tmp/electerm_build
run: rm -rf ~/.cache/electron-builder
- name: ci init
working-directory: /tmp/electerm_build
run: npm config set legacy-peer-deps true
- name: Update electron version and remove package-lock
working-directory: /tmp/electerm_build
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '22.3.27';
pkg.devDependencies['electron-builder'] = '26.0.20';
pkg.devDependencies['@electron/rebuild'] = '3.7.2';
pkg.dependencies['node-pty'] = '0.10.1';
pkg.dependencies.serialport = '10.5.0';
pkg.devDependencies.vite = '4';
pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
rm -f package-lock.json
- name: Install npm dependencies
working-directory: /tmp/electerm_build
run: npm i && npm i -S @electron/rebuild@3.7.2
- name: Install R2 dependencies if needed
working-directory: /tmp/electerm_build
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
- name: Build application
working-directory: /tmp/electerm_build
run: npm run b
- name: Run pb
working-directory: /tmp/electerm_build
run: npm run pb
- name: Build legacy packages
working-directory: /tmp/electerm_build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
USE_SYSTEM_FPM: true
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-linux-arm-legacy
+111
View File
@@ -0,0 +1,111 @@
# Alternative workflow using native ARM64 runners
name: linux-arm-native
on:
push:
branches: [ build, test, build-only, linux-arm ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04-arm
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip arm-linux]') && !contains(github.event.head_commit.message, '[skip linux3]') }}
env:
# Force electron-builder to use the system fpm (ARM native) instead of downloading x86 prebuilt bundle
USE_SYSTEM_FPM: true
steps:
- uses: actions/checkout@v4
- name: Set up Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
python3-dev \
build-essential \
libnss3-dev \
libsecret-1-dev \
fakeroot \
rpm \
libgtk-3-0 \
libnotify4 \
libnss3 \
libxss1 \
libxtst6 \
xdg-utils \
libatspi2.0-0 \
libuuid1 \
libsecret-1-0 \
libappindicator3-1 \
ruby-full
- name: Install FPM
run: sudo gem install fpm
- name: Verify glibc version
run: ldd --version
- name: Verify fpm
run: |
which fpm
fpm --version
- name: Install yarn
run: npm install -g yarn
- name: ci init
run: npm config set legacy-peer-deps true
- name: Clear electron-builder cache
run: rm -rf ~/.cache/electron-builder
- name: Update electron version and remove package-lock
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '22.3.27';
pkg.devDependencies['electron-builder'] = '26.0.20';
pkg.devDependencies['@electron/rebuild'] = '3.7.2';
pkg.dependencies['node-pty'] = '1.1.0-beta14';
pkg.dependencies.serialport = '13.0.0';
pkg.devDependencies.vite = '4';
pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
rm -f package-lock.json
- name: Install npm dependencies
run: npm i && npm i -S @electron/rebuild@3.7.2
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
- name: Build application
run: npm run b
- name: Run pb
run: npm run pb
- name: Build ARM64 packages
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
run: node build/bin/build-linux-arm
+57
View File
@@ -0,0 +1,57 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: linux-deb-tar
on:
push:
branches: [ build, test, build-only, linux-deb-tar ]
jobs:
build:
runs-on: ubuntu-24.04
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip linux]') && !contains(github.event.head_commit.message, '[skip linux1]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
# - name: xvfb
# uses: GabrielBB/xvfb-action@v1
# before_script:
# - run: export DISPLAY=:99.0
# - run: sh -e /etc/init.d/xvfb start &
# - run: sleep 3
# before_install:
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- run: npm i
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-linux-deb-tar
+109
View File
@@ -0,0 +1,109 @@
# Simplified workflow using custom electerm-builder Docker image
name: linux-legacy-docker
on:
push:
branches: [ build, test, build-only, linux-legacy, legacy-build ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container: zxdong262/electerm-builder-legacy:latest # This will be our custom image
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip legacy]') && !contains(github.event.head_commit.message, '[skip linux-legacy]') }}
steps:
- name: Clone repository to /tmp and setup
run: |
cd /tmp
git clone https://github.com/electerm/electerm.git electerm_build
cd electerm_build
git checkout ${{ github.sha }}
# Configure npm to use /tmp for cache and global packages
mkdir -p /tmp/.npm /tmp/.npm-global
npm config set cache /tmp/.npm
npm config set prefix /tmp/.npm-global
export PATH="/tmp/.npm-global/bin:$PATH"
echo "PATH=/tmp/.npm-global/bin:$PATH" >> $GITHUB_ENV
echo "npm_config_cache=/tmp/.npm" >> $GITHUB_ENV
echo "npm_config_prefix=/tmp/.npm-global" >> $GITHUB_ENV
- name: Verify pre-installed versions
working-directory: /tmp/electerm_build
run: |
echo "=== Pre-installed versions ==="
node --version
npm --version
yarn --version
python3 --version
python --version
gcc --version
g++ --version
fpm --version
- name: Clear electron-builder cache
working-directory: /tmp/electerm_build
run: rm -rf ~/.cache/electron-builder
- name: ci init
working-directory: /tmp/electerm_build
run: npm config set legacy-peer-deps true
- name: Update electron version and remove package-lock
working-directory: /tmp/electerm_build
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '22.3.27';
pkg.devDependencies['electron-builder'] = '26.0.20';
pkg.devDependencies['@electron/rebuild'] = '3.7.2';
pkg.dependencies['node-pty'] = '0.10.1';
pkg.dependencies.serialport = '10.5.0';
pkg.devDependencies.vite = '4';
pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
fs.unlinkSync('package-lock.json');
"
- name: Install npm dependencies
working-directory: /tmp/electerm_build
run: npm i && npm i -S @electron/rebuild@3.7.2
- name: Install R2 dependencies if needed
working-directory: /tmp/electerm_build
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
- name: Verify updated dependencies
working-directory: /tmp/electerm_build
run: |
echo "Verifying updated dependencies:"
npm list electron --depth=0
npm list @electron/rebuild --depth=0
npm list node-pty --depth=0
npm list serialport --depth=0
npm list vite --depth=0
- name: Build application
working-directory: /tmp/electerm_build
run: npm run b
- name: Run pb
working-directory: /tmp/electerm_build
run: npm run pb
- name: Build legacy packages
working-directory: /tmp/electerm_build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
USE_SYSTEM_FPM: true
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-linux-legacy
+142
View File
@@ -0,0 +1,142 @@
# Build electerm for loong64 (LoongArch64) Linux - Legacy (old world)
#
# This workflow:
# 1. Downloads GCC 8 cross-compiler from Loongnix for old-world ABI
# 2. Builds x64 version with legacy deps to get the asar
# 3. Downloads electron loong64 from Loongnix
# 4. Cross-compile native modules for loong64 with legacy deps
# 5. Merges x64 asar with loong64 electron and native modules
# 6. Uploads tar.gz to GitHub release draft
# 7. Builds deb package and uploads to GitHub release draft
# 8. Optionally uploads to R2
name: linux-loong64-legacy
on:
push:
branches: [ build, test, build-only, linux-loong64-legacy ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip linux]') && !contains(github.event.head_commit.message, '[skip loong64]') && !contains(github.event.head_commit.message, '[skip legacy]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install loong64 cross-compiler and GCC 8 from Loongnix
run: |
sudo add-apt-repository -y universe
sudo apt-get update
sudo apt-get install -y gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu binutils-loongarch64-linux-gnu || \
sudo apt-get install -y gcc-loongarch64-linux-gnu g++-loongarch64-linux-gnu binutils-loongarch64-linux-gnu || true
which loongarch64-linux-gnu-gcc 2>/dev/null || sudo ln -sf /usr/bin/loongarch64-linux-gnu-gcc-14 /usr/bin/loongarch64-linux-gnu-gcc || true
which loongarch64-linux-gnu-g++ 2>/dev/null || sudo ln -sf /usr/bin/loongarch64-linux-gnu-g++-14 /usr/bin/loongarch64-linux-gnu-g++ || true
# Download GCC 8 from Loongnix for old-world ABI support
# The Loongnix FTP server is unreliable and drops connections, so we retry with resume
echo "Downloading GCC 8 cross-compiler from Loongnix..."
URL="https://ftp.loongnix.cn/toolchain/gcc/release/loongarch/gcc8/loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.6.tar.xz"
for i in 1 2 3 4 5; do
echo "Attempt $i..."
curl -L --retry 3 --retry-delay 5 -C - -o /tmp/gcc8-loong64.tar.xz "$URL" && break
echo "Attempt $i failed, retrying..."
sleep 10
done
sudo mkdir -p /opt/gcc8-loong64
sudo tar xJf /tmp/gcc8-loong64.tar.xz -C /opt/gcc8-loong64 --strip-components=1
echo "/opt/gcc8-loong64/bin" >> $GITHUB_PATH
export PATH="/opt/gcc8-loong64/bin:$PATH"
loongarch64-linux-gnu-gcc --version
- run: rm package-lock.json
- run: npm config set legacy-peer-deps true
- name: Update package.json with legacy deps
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '22.3.27';
pkg.devDependencies['electron-builder'] = '26.0.20';
pkg.devDependencies['@electron/rebuild'] = '3.7.2';
pkg.dependencies['node-pty'] = '1.1.0';
pkg.dependencies.serialport = '10.5.0';
pkg.devDependencies.vite = '4';
pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0';
console.log('Version:', pkg.version);
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
- name: Install npm dependencies
run: |
npm config set legacy-peer-deps true
npm install -g yarn
npm i && npm i -S @electron/rebuild@3.7.2
- name: Verify updated dependencies
run: |
echo "Verifying updated dependencies:"
npm list electron --depth=0
npm list @electron/rebuild --depth=0
npm list node-pty --depth=0
npm list serialport --depth=0
npm list vite --depth=0
- name: Build loong64 legacy
env:
WORKFLOW_NAME: linux-loong64-legacy
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
run: bash build/bin/build-linux-loong64-legacy.sh
- name: Verify output
run: |
ls -la dist-loong64-legacy/*.tar.gz dist-loong64-legacy/*.deb
file dist-loong64-legacy/electerm-*/electerm
echo "=== Native modules ==="
find dist-loong64-legacy/electerm-* -name "*.node" -exec sh -c 'echo "--- $1 ---"; file "$1"; readelf -h "$1" 2>/dev/null | grep -E "Machine|Class"; readelf -d "$1" 2>/dev/null | grep NEEDED' _ {} \;
echo "=== pty.node symbols (forkpty/openpty) ==="
find dist-loong64-legacy/electerm-* -name "pty.node" -exec readelf -s {} \; 2>/dev/null | grep -iE "forkpty|openpty|pty" || true
echo "=== Build logs ==="
cat /tmp/node-pty-build.log 2>/dev/null | tail -50 || echo "No node-pty build log"
cat /tmp/serialport-build.log 2>/dev/null | tail -30 || echo "No serialport build log"
# - name: Upload build logs
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: build-logs
# path: /tmp/*-build.log
# retention-days: 7
- name: Upload to R2
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
env:
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
run: |
mkdir -p ~/.aws
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = ${{ secrets.CF_R2_ACCESS_KEY_ID }}
aws_secret_access_key = ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
EOF
cat > ~/.aws/config << EOF
[default]
region = auto
endpoint_url = ${{ secrets.CF_R2_ENDPOINT }}
EOF
for file in $(find dist-loong64-legacy \( -name "*.tar.gz" -o -name "*.deb" \) -type f); do
filename=$(basename "$file")
aws s3 cp "$file" "s3://${CF_R2_BUCKET}/${filename}" \
--acl public-read \
--cache-control "max-age=31536000"
echo "Uploaded: ${filename}"
done
+94
View File
@@ -0,0 +1,94 @@
# Build electerm for loong64 (LoongArch64) Linux
#
# This workflow:
# 1. Builds x64 version with electron v39.2.7 to get the asar
# 2. Downloads electron loong64 v39.2.7
# 3. Cross-compiles native modules for loong64
# 4. Merges x64 asar with loong64 electron and native modules
# 5. Uploads tar.gz to GitHub release draft
# 6. Builds deb package and uploads to GitHub release draft
# 7. Optionally uploads to R2
name: linux-loong64
on:
push:
branches: [ build, test, build-only, linux-loong64 ]
jobs:
build:
runs-on: ubuntu-24.04
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip linux]') && !contains(github.event.head_commit.message, '[skip loong64]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- name: Install loong64 cross-compiler
run: |
sudo add-apt-repository -y universe
sudo apt-get update
sudo apt-get install -y gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu binutils-loongarch64-linux-gnu || \
sudo apt-get install -y gcc-loongarch64-linux-gnu g++-loongarch64-linux-gnu binutils-loongarch64-linux-gnu
which loongarch64-linux-gnu-gcc 2>/dev/null || sudo ln -sf /usr/bin/loongarch64-linux-gnu-gcc-14 /usr/bin/loongarch64-linux-gnu-gcc || true
which loongarch64-linux-gnu-g++ 2>/dev/null || sudo ln -sf /usr/bin/loongarch64-linux-gnu-g++-14 /usr/bin/loongarch64-linux-gnu-g++ || true
- run: rm package-lock.json
- run: npm config set legacy-peer-deps true
- name: Update electron version to v39.2.7
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '39.2.7';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
console.log('Electron version set to 39.2.7');
"
- name: Install dependencies
run: |
npm config set legacy-peer-deps true
npm install -g yarn
npm i
- name: Build loong64
env:
WORKFLOW_NAME: linux-loong64
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
run: bash build/bin/build-linux-loong64.sh
- name: Verify output
run: |
ls -la dist-loong64/*.tar.gz dist-loong64/*.deb
file dist-loong64/electerm-*/electerm
find dist-loong64/electerm-* -name "*.node" -exec file {} \; | grep LoongArch
- name: Upload to R2
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
env:
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
run: |
mkdir -p ~/.aws
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = ${{ secrets.CF_R2_ACCESS_KEY_ID }}
aws_secret_access_key = ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
EOF
cat > ~/.aws/config << EOF
[default]
region = auto
endpoint_url = ${{ secrets.CF_R2_ENDPOINT }}
EOF
for file in $(find dist-loong64 \( -name "*.tar.gz" -o -name "*.deb" \) -type f); do
filename=$(basename "$file")
aws s3 cp "$file" "s3://${CF_R2_BUCKET}/${filename}" \
--acl public-read \
--cache-control "max-age=31536000"
echo "Uploaded: ${filename}"
done
+70
View File
@@ -0,0 +1,70 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: linux-rpm-snap
on:
push:
branches: [ build, test, build-only, linux-rpm-snap ]
jobs:
build:
runs-on: ubuntu-24.04
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip linux]') && !contains(github.event.head_commit.message, '[skip linux2]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
# - name: xvfb
# uses: GabrielBB/xvfb-action@v1
- name: Install rpm
run: sudo apt-get install rpm -y
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@master
# before_script:
# - run: export DISPLAY=:99.0
# - run: sh -e /etc/init.d/xvfb start &
# - run: sleep 3
# before_install:
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- run: npm i
# - run: npm i -D -E electron-builder@24.9.1
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-linux-rpm-snap
- name: upload to snap store
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_TOKEN }}
run: snapcraft upload --release=edge dist/*.snap
+70
View File
@@ -0,0 +1,70 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: mac-10
on:
push:
branches: [ build, test, build-only, mac-10, legacy-build ]
jobs:
build:
runs-on: macos-15-intel
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') && !contains(github.event.head_commit.message, '[skip mac-10]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# before_install:
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- name: Update electron version and remove package-lock
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '22.3.27';
pkg.devDependencies['electron-builder'] = '26.0.20';
pkg.devDependencies['@electron/rebuild'] = '3.7.2';
pkg.dependencies['node-pty'] = '1.1.0-beta14';
pkg.dependencies.serialport = '13.0.0';
pkg.devDependencies.vite = '4';
pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
fs.unlinkSync('package-lock.json');
"
- run: npm i && npm i -S @electron/rebuild@3.7.2
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
APPLE_TEAM_ID: ${{secrets.APPLE_TEAM_ID}}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-mac-10
+57
View File
@@ -0,0 +1,57 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: mac-arm
on:
push:
branches: [ build, test, build-only, mac-arm ]
jobs:
build:
runs-on: macos-15
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') && !contains(github.event.head_commit.message, '[skip arm]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# before_install:
- run: pip install setuptools
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- run: npm i
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
APPLE_TEAM_ID: ${{secrets.APPLE_TEAM_ID}}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-mac-arm
+51
View File
@@ -0,0 +1,51 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: mac-x64-test-1
on:
push:
branches: [ build, test, test-only, test1 ]
jobs:
build:
runs-on: macos-15-intel
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') && !contains(github.event.head_commit.message, '[skip test1]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.15.0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# before_install:
- run: pip install setuptools
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- run: npm i
- run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D -E playwright@1.49.1 && npm i -D -E @playwright/test@1.49.1
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: test
uses: GabrielBB/xvfb-action@v1
with:
run: npm run test1
env:
NODE_TEST: 1
TEST_HOST: ${{ secrets.TEST_HOST }}
TEST_USER: ${{ secrets.TEST_USER_1 }}
TEST_PASS: ${{ secrets.TEST_PASS_1 }}
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
GIST_ID: ${{ secrets.GIST_ID }}
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
GITEE_ID: ${{ secrets.GITEE_ID }}
+56
View File
@@ -0,0 +1,56 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: mac-x64-test-2
on:
push:
branches: [ build, test, test-only ]
jobs:
build:
runs-on: macos-15-intel
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') && !contains(github.event.head_commit.message, '[skip test2]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.15.0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# before_install:
- run: pip install setuptools
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- run: npm i
- run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D -E playwright@1.49.1 && npm i -D -E @playwright/test@1.49.1
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: test
uses: GabrielBB/xvfb-action@v1
with:
run: npm run test2
env:
NODE_TEST: 1
TEST_HOST: ${{ secrets.TEST_HOST }}
TEST_USER: ${{ secrets.TEST_USER_2 }}
TEST_PASS: ${{ secrets.TEST_PASS_2 }}
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
GIST_ID: ${{ secrets.GIST_ID }}
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
GITEE_ID: ${{ secrets.GITEE_ID }}
CUSTOM_SYNC_URL: ${{ secrets.CUSTOM_SYNC_URL }}
CUSTOM_SYNC_USER: ${{ secrets.CUSTOM_SYNC_USER }}
CUSTOM_SYNC_SECRET: ${{ secrets.CUSTOM_SYNC_SECRET }}
CLOUD_TOKEN: ${{ secrets.CLOUD_TOKEN }}
+56
View File
@@ -0,0 +1,56 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: mac-x64-test-3
on:
push:
branches: [ build, test, test-only, test3 ]
jobs:
build:
runs-on: macos-15-intel
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip test]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') && !contains(github.event.head_commit.message, '[skip test3]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.15.0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# before_install:
- run: pip install setuptools
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- run: npm i
- run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D -E playwright@1.49.1 && npm i -D -E @playwright/test@1.49.1
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: test
uses: GabrielBB/xvfb-action@v1
with:
run: npm run test3
env:
NODE_TEST: 1
TEST_HOST: ${{ secrets.TEST_HOST }}
TEST_USER: ${{ secrets.TEST_USER_3 }}
TEST_PASS: ${{ secrets.TEST_PASS_3 }}
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
GIST_ID: ${{ secrets.GIST_ID }}
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
GITEE_ID: ${{ secrets.GITEE_ID }}
CUSTOM_SYNC_URL: ${{ secrets.CUSTOM_SYNC_URL }}
CUSTOM_SYNC_USER: ${{ secrets.CUSTOM_SYNC_USER }}
CUSTOM_SYNC_SECRET: ${{ secrets.CUSTOM_SYNC_SECRET }}
CLOUD_TOKEN: ${{ secrets.CLOUD_TOKEN }}
+56
View File
@@ -0,0 +1,56 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: mac-x64
on:
push:
branches: [ build, test, build-only, mac-x64 ]
jobs:
build:
runs-on: macos-15-intel
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip mac]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# before_install:
- run: npm config set legacy-peer-deps true
- run: npm install -g yarn
- run: npm i
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
APPLE_TEAM_ID: ${{secrets.APPLE_TEAM_ID}}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-mac
+504
View File
@@ -0,0 +1,504 @@
# Upload APPX to Microsoft Store after a new release is published.
# Downloads the .appx artifact from the GitHub release and submits
# a new Store submission via the Partner Center Ingestion API.
name: ms-store-upload
on:
release:
types: [released]
push:
branches: [ ms ]
jobs:
upload-to-store:
runs-on: windows-2022
environment: build
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- name: Install R2 dependencies if store upload may run
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
- name: Determine release tag
id: tag
env:
GH_TOKEN: ${{ github.token }}
shell: pwsh
run: |
$tag = "${{ github.event.release.tag_name }}"
if (-not $tag) {
Write-Host "No release tag from event, fetching latest release..."
$tag = (gh release view --repo "${{ github.repository }}" --json tagName -q '.tagName')
if (-not $tag) { throw 'Could not determine release tag.' }
}
Write-Host "Release tag: $tag"
"tag_name=$tag" >> $env:GITHUB_OUTPUT
- name: Download APPX from release
env:
GH_TOKEN: ${{ github.token }}
shell: pwsh
run: |
$tag = "${{ steps.tag.outputs.tag_name }}"
New-Item -ItemType Directory -Force -Path dist | Out-Null
gh release download "$tag" --repo "${{ github.repository }}" --pattern '*.appx' -D dist
Write-Host 'Downloaded APPX files:'
Get-ChildItem -Path dist -Filter '*.appx' -Recurse | Format-Table FullName, Length
- name: Setup Microsoft Store Developer CLI
uses: microsoft/microsoft-store-apppublisher@v1.1
- name: Configure Microsoft Store Developer CLI
env:
MS_TENANT_ID: ${{ secrets.MS_TENANT_ID }}
MS_SELLER_ID: ${{ secrets.MS_SELLER_ID }}
MS_CLIENT_ID: ${{ secrets.MS_CLIENT_ID }}
MS_CLIENT_SECRET: ${{ secrets.MS_CLIENT_SECRET }}
run: msstore reconfigure --tenantId "$env:MS_TENANT_ID" --sellerId "$env:MS_SELLER_ID" --clientId "$env:MS_CLIENT_ID" --clientSecret "$env:MS_CLIENT_SECRET"
shell: pwsh
- name: Debug Microsoft Store app access
continue-on-error: true
env:
MS_PRODUCT_ID: ${{ secrets.MS_PRODUCT_ID }}
MS_APP_ID: ${{ secrets.MS_APP_ID }}
MSSTORE_LOG_FILE: dist/msstore-logs/msstore-${{ github.run_id }}-${{ github.run_attempt }}.log
run: |
function Get-VisibleProductIds([string] $appsListOutput) {
$cleanOutput = [regex]::Replace($appsListOutput, '\x1B\[[0-9;?]*[ -/]*[@-~]', '')
return @(
$cleanOutput -split "`r?`n" |
Where-Object { $_.Trim().StartsWith('│') } |
ForEach-Object {
$columns = $_.Trim().Split('│') | ForEach-Object { $_.Trim() }
if ($columns.Count -ge 5) {
$productId = $columns[2]
$packageId = $columns[4]
if ($productId -and $productId -ne 'ProductId' -and $packageId -and $packageId -ne 'PackageId') {
$productId
}
}
} |
Select-Object -Unique
)
}
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $env:MSSTORE_LOG_FILE) | Out-Null
Set-Content -Path $env:MSSTORE_LOG_FILE -Value "=== Microsoft Store debug log $(Get-Date -Format o) ==="
function Write-StoreLog([string] $message) {
Add-Content -Path $env:MSSTORE_LOG_FILE -Value $message
}
$msstoreVersion = & msstore --version 2>&1 | Out-String
Write-Host "msstore CLI version: $msstoreVersion"
Write-StoreLog "msstore CLI version: $msstoreVersion"
$configuredProductId = "$env:MS_PRODUCT_ID".Trim()
if (-not $configuredProductId) {
$configuredProductId = "$env:MS_APP_ID".Trim()
}
if ($configuredProductId) {
Write-Host "Configured Store Product ID: $configuredProductId"
} else {
Write-Host 'Configured Store Product ID: <empty>'
}
Write-Host 'Package identifiers in this repo are not valid Store Product IDs:'
Write-Host ' Electron appId: org.electerm.electerm'
Write-Host ' APPX applicationId: electerm'
Write-Host ' APPX identityName: 64159ZHAOXudong.electerm'
Write-Host 'Accessible Microsoft Store packaged apps for this account:'
Write-StoreLog "Configured Store Product ID: $configuredProductId"
Write-StoreLog 'Package identifiers in this repo are not valid Store Product IDs:'
Write-StoreLog ' Electron appId: org.electerm.electerm'
Write-StoreLog ' APPX applicationId: electerm'
Write-StoreLog ' APPX identityName: 64159ZHAOXudong.electerm'
Write-StoreLog 'Accessible Microsoft Store packaged apps for this account:'
Write-StoreLog ''
Write-StoreLog "=== msstore apps list $(Get-Date -Format o) ==="
$appsListOutput = (& msstore apps list 2>&1 | Tee-Object -FilePath $env:MSSTORE_LOG_FILE -Append | Out-String)
$appsListExitCode = $LASTEXITCODE
$global:LASTEXITCODE = 0
Write-Host $appsListOutput
Write-StoreLog "msstore apps list exit code: $appsListExitCode"
$productIds = Get-VisibleProductIds $appsListOutput
if ($appsListExitCode -ne 0) {
Write-Host "msstore apps list exited with code $appsListExitCode. This usually means the configured Entra app can authenticate but does not have Partner Center access to packaged apps for this seller account."
} elseif ($productIds.Count -eq 0) {
Write-Host 'msstore apps list succeeded but no packaged Product IDs were detected. This usually means no packaged Store apps are visible to this account.'
} elseif (-not $configuredProductId) {
if ($productIds.Count -eq 1) {
Write-Host "Exactly one packaged Product ID is visible: $($productIds[0])"
} else {
Write-Host "Multiple packaged Product IDs are visible: $($productIds -join ', ')"
}
} elseif ($configuredProductId -notin $productIds) {
Write-Host "Configured Store Product ID '$configuredProductId' was not found in the accessible app list."
Write-Host "Visible Product IDs: $($productIds -join ', ')"
} else {
Write-Host "Configured Store Product ID '$configuredProductId' is visible to this account."
}
shell: pwsh
- name: Upload APPX to Microsoft Store and submit for certification
env:
MS_PRODUCT_ID: ${{ secrets.MS_PRODUCT_ID }}
MS_APP_ID: ${{ secrets.MS_APP_ID }}
MS_TENANT_ID: ${{ secrets.MS_TENANT_ID }}
MS_CLIENT_ID: ${{ secrets.MS_CLIENT_ID }}
MS_CLIENT_SECRET: ${{ secrets.MS_CLIENT_SECRET }}
MSSTORE_LOG_FILE: dist/msstore-logs/msstore-${{ github.run_id }}-${{ github.run_attempt }}.log
run: |
# ── Initialise log file ─────────────────────────────────────────────────
New-Item -ItemType Directory -Force -Path (Split-Path -Parent $env:MSSTORE_LOG_FILE) | Out-Null
Set-Content -Path $env:MSSTORE_LOG_FILE -Value "=== ms-store-upload log $(Get-Date -Format o) ==="
function Write-StoreLog([string] $message) {
Add-Content -Path $env:MSSTORE_LOG_FILE -Value $message
}
# Retry wrapper for Invoke-RestMethod with exponential backoff.
# The Partner Center Ingestion API is behind Azure Front Door and can
# return transient 504 / 502 / 503 responses under load.
function Invoke-WithRetry {
param(
[Parameter(Mandatory=$true)] [scriptblock] $Action,
[string] $Description = 'API call',
[int] $MaxRetries = 5,
[int] $BaseDelaySec = 10
)
for ($i = 0; $i -lt $MaxRetries; $i++) {
try {
return & $Action
} catch {
$statusCode = $null
if ($_.Exception.Response) {
$statusCode = [int]$_.Exception.Response.StatusCode
}
$isTransient = $false
if ($statusCode -in 408, 429, 500, 502, 503, 504) { $isTransient = $true }
if ($_.Exception.Message -match 'timed?\s*out|gateway|service unavailable|connection was closed|unable to connect') { $isTransient = $true }
$attempt = $i + 1
if ($isTransient -and $attempt -lt $MaxRetries) {
$delay = $BaseDelaySec * [Math]::Pow(2, $i)
Write-Host " ⚠ ${Description}: transient error (HTTP $statusCode) on attempt $attempt/$MaxRetries — retrying in ${delay}s..."
Write-StoreLog "${Description}: transient error (HTTP $statusCode) attempt $attempt/$MaxRetries, retry in ${delay}s. $($_.Exception.Message)"
Start-Sleep -Seconds $delay
} else {
Write-StoreLog "${Description}: FAILED on attempt $attempt (HTTP $statusCode). $($_.Exception.Message)"
throw
}
}
}
}
function Get-VisibleProductIds([string] $appsListOutput) {
$cleanOutput = [regex]::Replace($appsListOutput, '\x1B\[[0-9;?]*[ -/]*[@-~]', '')
return @(
$cleanOutput -split "`r?`n" |
Where-Object { $_.Trim().StartsWith('│') } |
ForEach-Object {
$columns = $_.Trim().Split('│') | ForEach-Object { $_.Trim() }
if ($columns.Count -ge 5) {
$productId = $columns[2]
$packageId = $columns[4]
if ($productId -and $productId -ne 'ProductId' -and $packageId -and $packageId -ne 'PackageId') {
$productId
}
}
} |
Select-Object -Unique
)
}
try {
$appx = Get-ChildItem -Path dist -Filter '*.appx' -Recurse | Select-Object -First 1
if (-not $appx) { throw 'No .appx file found under dist/' }
Write-StoreLog ''
Write-StoreLog "=== publish preflight $(Get-Date -Format o) ==="
Write-StoreLog "APPX file: $($appx.FullName)"
# Soft preflight: enumerate accessible packaged apps.
# 'msstore apps list' can fail on its own (e.g. a CLI regression pulled in by
# 'version: latest') even when the Entra app and the configured Product ID are
# perfectly valid. The actual submission below calls the Dev Center Ingestion API
# directly and does not depend on this command, so when MS_PRODUCT_ID is explicitly
# configured we trust it and proceed instead of aborting the whole build.
$appsListOutput = (& msstore apps list 2>&1 | Tee-Object -FilePath $env:MSSTORE_LOG_FILE -Append | Out-String)
$appsListExitCode = $LASTEXITCODE
$global:LASTEXITCODE = 0
Write-StoreLog "msstore apps list exit code: $appsListExitCode"
$productIds = Get-VisibleProductIds $appsListOutput
$productId = "$env:MS_PRODUCT_ID".Trim()
if (-not $productId) {
$productId = "$env:MS_APP_ID".Trim()
}
if (-not $productId) {
# No explicitly configured id: we must rely on the app list.
if ($appsListExitCode -eq 0 -and $productIds.Count -eq 1) {
$productId = $productIds[0]
Write-Host "Resolved MS Product ID from account app list: $productId"
} else {
$visibleProductIds = if ($productIds.Count) { $productIds -join ', ' } else { 'none detected' }
throw "Missing MS_PRODUCT_ID or MS_APP_ID secret and could not resolve a single Product ID from 'msstore apps list' (exit $appsListExitCode). Visible Product IDs for this account: $visibleProductIds"
}
} elseif ($appsListExitCode -ne 0 -or $productIds.Count -eq 0) {
Write-Host "WARNING: 'msstore apps list' failed (exit $appsListExitCode) but MS_PRODUCT_ID is explicitly configured; proceeding with the configured Product ID."
Write-StoreLog "WARNING: 'msstore apps list' failed (exit $appsListExitCode); proceeding with configured Product ID: $productId"
} elseif ($productId -notin $productIds) {
Write-Host "WARNING: Configured Store Product ID '$productId' was not found in the accessible app list; proceeding with the configured value anyway."
Write-StoreLog "WARNING: Configured Store Product ID '$productId' not in accessible app list; proceeding."
} else {
Write-Host "Configured Store Product ID '$productId' is visible to this account."
}
$knownWrongAppIds = @(
'org.electerm.electerm',
'electerm',
'64159ZHAOXudong.electerm'
)
if ($knownWrongAppIds -contains $productId) {
throw "Configured store identifier '$productId' is a package identifier. Use the Microsoft Store Partner Center product id instead."
}
Write-Host "Resolved publish Product ID: $productId"
Write-StoreLog "Resolved publish Product ID: $productId"
# ── Direct Ingestion API publish ───────────────────────────────────────
# msstore publish copies listing features verbatim from the live submission.
# If any locale has >20 features the Ingestion API rejects the update.
# We bypass msstore publish and call the API directly so we can cap features.
Write-StoreLog ''
Write-StoreLog "=== direct-api publish $(Get-Date -Format o) ==="
# 1. Get OAuth token for the Partner Center Ingestion API
$tokenParts = @(
"grant_type=client_credentials",
"client_id=$([uri]::EscapeDataString($env:MS_CLIENT_ID))",
"client_secret=$([uri]::EscapeDataString($env:MS_CLIENT_SECRET))",
"scope=$([uri]::EscapeDataString('https://manage.devcenter.microsoft.com/.default'))"
)
$tokenResp = Invoke-WithRetry -Description 'Get OAuth token' {
Invoke-RestMethod `
-Uri "https://login.microsoftonline.com/$env:MS_TENANT_ID/oauth2/v2.0/token" `
-Method Post -ContentType 'application/x-www-form-urlencoded' `
-Body ($tokenParts -join '&')
}
$token = $tokenResp.access_token
Write-StoreLog "OAuth token acquired."
$h = @{ Authorization = "Bearer $token" }
$apiBase = "https://manage.devcenter.microsoft.com/v1.0/my/applications/$productId"
# 2. Get app info; delete any pending submission
Write-Host "Getting app info..."
$appInfo = Invoke-WithRetry -Description 'Get app info' { Invoke-RestMethod -Uri $apiBase -Headers $h }
Write-StoreLog "App info fetched. lastPublishedSubmission: $($appInfo.lastPublishedApplicationSubmission.id)"
if ($appInfo.pendingApplicationSubmission.id) {
$pendingId = $appInfo.pendingApplicationSubmission.id
Write-Host "Deleting pending submission $pendingId ..."
Write-StoreLog "Deleting pending submission: $pendingId"
Invoke-WithRetry -Description 'Delete pending submission' { Invoke-RestMethod -Uri "$apiBase/submissions/$pendingId" -Method Delete -Headers $h } | Out-Null
Write-Host "Deleted pending submission."
Write-StoreLog "Deleted pending submission."
}
# 3. Fetch last published submission to use as the body for POST /submissions.
# The API does NOT auto-clone — it requires the full submission object.
$lastPubSubId = $appInfo.lastPublishedApplicationSubmission.id
if (-not $lastPubSubId) { throw 'No published submission found to clone from.' }
Write-Host "Fetching published submission $lastPubSubId as template..."
Write-StoreLog "Fetching published submission: $lastPubSubId"
$pubSub = Invoke-WithRetry -Description 'Fetch published submission template' { Invoke-RestMethod -Uri "$apiBase/submissions/$lastPubSubId" -Headers $h }
# 4. Create new submission using the published submission data as the request body.
# A 504/502 gateway timeout can still result in the submission being created
# server-side. A naive retry would then fail with HTTP 409 Conflict
# (InvalidState) because the Ingestion API only allows one pending
# submission at a time. After any failure we re-fetch app info and reuse
# the pending submission if one now exists instead of blindly retrying.
Write-Host "Creating new submission..."
Write-StoreLog "Creating new submission (POST with published data as body)..."
$pubSubBytes = [System.Text.Encoding]::UTF8.GetBytes(($pubSub | ConvertTo-Json -Depth 30 -Compress))
$newSub = $null
$maxCreateRetries = 5
$submissionReady = $false
for ($i = 0; $i -lt $maxCreateRetries -and -not $submissionReady; $i++) {
try {
$newSub = Invoke-RestMethod -Uri "$apiBase/submissions" -Method Post -Headers $h -ContentType 'application/json' -Body $pubSubBytes
$submissionReady = $true
} catch {
$statusCode = $null
if ($_.Exception.Response) {
$statusCode = [int]$_.Exception.Response.StatusCode
}
$errBody = ''
if ($_.ErrorDetails -and $_.ErrorDetails.Message) {
$errBody = $_.ErrorDetails.Message
}
$attempt = $i + 1
$isRecoverable = ($statusCode -in 409, 502, 503, 504) -or
($errBody -match 'Conflict|InvalidState') -or
($_.Exception.Message -match 'timed?\s*out|gateway|service unavailable|connection was closed')
if ($isRecoverable -and $attempt -lt $maxCreateRetries) {
$delay = 10 * [Math]::Pow(2, $i)
Write-Host " ⚠ Create new submission: HTTP $statusCode on attempt $attempt/$maxCreateRetries — checking for pending submission in ${delay}s..."
Write-StoreLog "Create new submission: HTTP $statusCode attempt $attempt/$maxCreateRetries, retry in ${delay}s. $errBody"
Start-Sleep -Seconds $delay
# Re-fetch app info — the failed POST may have created a pending submission.
# Use Invoke-WithRetry because the API may be experiencing widespread 504s.
try {
$appInfoRetry = Invoke-WithRetry -Description 'Re-fetch app info for pending submission' { Invoke-RestMethod -Uri $apiBase -Headers $h }
if ($appInfoRetry.pendingApplicationSubmission.id) {
$pendingSubId = $appInfoRetry.pendingApplicationSubmission.id
Write-Host " Found pending submission $pendingSubId — reusing it."
Write-StoreLog "Reusing existing pending submission: $pendingSubId"
$pendingSub = Invoke-WithRetry -Description 'Fetch pending submission details' { Invoke-RestMethod -Uri "$apiBase/submissions/$pendingSubId" -Headers $h }
$newSub = [PSCustomObject]@{
id = $pendingSubId
fileUploadUrl = $pendingSub.fileUploadUrl
}
$submissionReady = $true
}
} catch {
Write-Host " Could not re-fetch app info or submission: $($_.Exception.Message)"
Write-StoreLog "Re-fetch failed: $($_.Exception.Message)"
}
} else {
Write-StoreLog "Create new submission: FAILED on attempt $attempt (HTTP $statusCode). $errBody"
throw
}
}
}
if (-not $newSub) { throw 'Failed to create new submission after retries.' }
$subId = $newSub.id
$fileUploadUrl = $newSub.fileUploadUrl
Write-Host "Submission ID: $subId"
Write-StoreLog "Submission ID: $subId"
# 5. Get full data for the new submission
$subData = Invoke-WithRetry -Description 'Get new submission data' { Invoke-RestMethod -Uri "$apiBase/submissions/$subId" -Headers $h }
# 6. Replace packages: mark existing for deletion, add new one as PendingUpload
$newPackages = @()
foreach ($pkg in @($subData.applicationPackages)) {
$pkg.fileStatus = 'PendingDelete'
$newPackages += $pkg
}
$newPackages += [PSCustomObject]@{ fileName = $appx.Name; fileStatus = 'PendingUpload' }
$subData.applicationPackages = $newPackages
Write-StoreLog "applicationPackages: $($newPackages.Count) entries (last = new PendingUpload)."
# Auto-publish after certification passes.
$subData.targetPublishMode = 'Immediate'
# 7. Push updated submission metadata
Write-Host "Updating submission metadata..."
Write-StoreLog "PUT submission metadata..."
$updateBodyBytes = [System.Text.Encoding]::UTF8.GetBytes(($subData | ConvertTo-Json -Depth 30 -Compress))
Invoke-WithRetry -Description 'PUT submission metadata' {
Invoke-RestMethod -Uri "$apiBase/submissions/$subId" -Method Put -Headers $h `
-ContentType 'application/json' -Body $updateBodyBytes
} | Out-Null
Write-Host "Submission metadata updated."
Write-StoreLog "Submission metadata updated."
# 8. Create ZIP and upload to Azure Blob SAS URL
# (SAS URL carries its own auth — do not include the Bearer token here)
$zipPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'electerm-appx-upload.zip')
if (Test-Path $zipPath) { Remove-Item $zipPath }
Compress-Archive -Path $appx.FullName -DestinationPath $zipPath
$zipSizeMB = [Math]::Round((Get-Item $zipPath).Length / 1MB, 1)
Write-Host "Uploading package ZIP ($zipSizeMB MB)..."
Write-StoreLog "Uploading package ZIP ($zipSizeMB MB) to Azure Blob SAS URL..."
$blobHeaders = @{ 'x-ms-blob-type' = 'BlockBlob'; 'Content-Type' = 'application/octet-stream' }
Invoke-WithRetry -Description 'Upload package ZIP to Azure Blob' { Invoke-RestMethod -Uri $fileUploadUrl -Method Put -Headers $blobHeaders -InFile $zipPath } | Out-Null
Write-Host "Package uploaded."
Write-StoreLog "Package uploaded."
# 9. Commit submission to trigger certification.
# targetPublishMode = 'Immediate' means it will go live automatically after passing certification.
Write-Host "Committing submission to trigger certification..."
Write-StoreLog "Committing submission (Immediate publish mode)..."
$commitResp = Invoke-WithRetry -Description 'Commit submission' { Invoke-RestMethod -Uri "$apiBase/submissions/$subId/commit" -Method Post -Headers $h -ContentType 'application/json' }
Write-Host "Submission committed. Certification will start shortly."
Write-StoreLog "Commit response status: $($commitResp.status)"
if ($commitResp.statusDetails) {
$errors = @($commitResp.statusDetails.errors)
$warnings = @($commitResp.statusDetails.warnings)
if ($errors.Count -gt 0) {
foreach ($e in $errors) {
Write-Host " ERROR: $($e.code) - $($e.details)"
Write-StoreLog " Commit error: $($e.code) - $($e.details)"
}
throw "Submission commit returned $($errors.Count) error(s)."
}
if ($warnings.Count -gt 0) {
foreach ($w in $warnings) {
Write-Host " WARNING: $($w.code) - $($w.details)"
Write-StoreLog " Commit warning: $($w.code) - $($w.details)"
}
}
}
Write-StoreLog "Done (committed, Immediate mode). SubmissionId: $subId"
# 10. Verify submission status after commit
Write-Host "Verifying submission status..."
Start-Sleep -Seconds 10
$subStatus = Invoke-WithRetry -Description 'Check submission status' { Invoke-RestMethod -Uri "$apiBase/submissions/$subId" -Headers $h }
Write-Host "Submission status: $($subStatus.status)"
Write-StoreLog "Post-commit submission status: $($subStatus.status)"
if ($subStatus.status -eq 'CommitFailed') {
$errDetails = if ($subStatus.statusDetails.errors) { $subStatus.statusDetails.errors | ForEach-Object { "$($_.code): $($_.details)" } | Out-String } else { 'no details' }
throw "Submission commit failed. Status: $($subStatus.status). Details: $errDetails"
}
} catch {
$errMsg = $_.ToString()
$errDetail = $_.Exception.Message
$errStack = $_.ScriptStackTrace
Write-Host "ERROR: $errMsg"
Write-StoreLog ''
Write-StoreLog "=== FATAL ERROR $(Get-Date -Format o) ==="
Write-StoreLog "Message : $errMsg"
Write-StoreLog "Detail : $errDetail"
Write-StoreLog "Stack :"
Write-StoreLog "$errStack"
throw $_
}
shell: pwsh
- name: Upload Microsoft Store raw log to R2
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
env:
MSSTORE_LOG_FILE: dist/msstore-logs/msstore-${{ github.run_id }}-${{ github.run_attempt }}.log
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: |
if (-not (Test-Path $env:MSSTORE_LOG_FILE)) {
Write-Host "Microsoft Store raw log file was not created: $env:MSSTORE_LOG_FILE"
exit 0
}
$key = "store-logs/ms-store-upload/${{ github.run_id }}-${{ github.run_attempt }}.log"
node build/bin/upload-file-to-r2.js "$env:MSSTORE_LOG_FILE" "$key"
shell: pwsh
+24
View File
@@ -0,0 +1,24 @@
name: publish-to-npm
on:
release:
types: [published]
push:
branches: [ test-npm ]
jobs:
release-npm:
runs-on: ubuntu-latest
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip npm]') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node and npm
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: https://registry.npmjs.org/
- run: node build/bin/prepublish.js
- run: npm config set legacy-peer-deps true && npm i
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{secrets.NPM_TOKEN}}
+52
View File
@@ -0,0 +1,52 @@
name: Sync Master to Gitee
on:
release:
types: [published]
workflow_dispatch:
jobs:
sync-master:
runs-on: ubuntu-latest
environment: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITEE_PRIVATE_SSH_TOKEN }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan gitee.com >> ~/.ssh/known_hosts
- name: Configure Git
run: |
git config --global user.name "ZHAO Xudong"
git config --global user.email "zxdong@gmail.com"
git remote add gitee git@gitee.com:github-zxdong262/electerm.git
- name: Push to Gitee
run: git push -f gitee HEAD:master
- name: Update version.html in gh-pages
run: |
# Get version from package.json using standard grep and sed
VERSION=$(curl -s https://raw.githubusercontent.com/electerm/electerm/master/package.json | grep '"version":' | sed 's/.*"version": "\([^"]*\).*/\1/')
# Checkout gh-pages branch
git fetch origin gh-pages:gh-pages
git checkout gh-pages
# Update version.html
echo "v$VERSION" > version.html
# Commit and push changes
git add version.html
git commit -m "Update version to v$VERSION"
git push origin gh-pages
# Also push to Gitee
git push gitee gh-pages
@@ -0,0 +1,59 @@
name: upload-release-assets-to-r2
on:
release:
types: [published]
push:
branches: [ r2 ]
jobs:
upload-to-r2:
runs-on: ubuntu-latest
environment: build
steps:
- name: Download all release assets
run: |
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
mkdir -p ./release-assets
gh release download "$TAG_NAME" --repo "${{ github.repository }}" -D ./release-assets
env:
GH_TOKEN: ${{ github.token }}
- name: List downloaded file
run: ls -la ./release-assets
- name: Configure AWS credentials for R2
run: |
mkdir -p ~/.aws
cat > ~/.aws/credentials << 'EOF'
[default]
aws_access_key_id = ${{ secrets.CF_R2_ACCESS_KEY_ID }}
aws_secret_access_key = ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
EOF
cat > ~/.aws/config << 'EOF'
[default]
region = auto
endpoint_url = ${{ secrets.CF_R2_ENDPOINT }}
EOF
- name: Delete existing r folder
env:
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
run: |
aws s3 rm "s3://${CF_R2_BUCKET}/r/" --recursive
- name: Upload all release assets to R2
env:
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
run: |
for file in $(find ./release-assets -type f); do
rel_path="${file#./release-assets/}"
aws s3 cp "$file" "s3://${CF_R2_BUCKET}/r/${rel_path}" \
--acl public-read \
--cache-control "max-age=31536000"
echo "Uploaded: ${rel_path}"
done
- name: Verify uploads
env:
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
run: |
aws s3 ls "s3://${CF_R2_BUCKET}/r/" --recursive
+55
View File
@@ -0,0 +1,55 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win-appx
on:
push:
branches: [ build, test, build-only, win-appx ]
jobs:
build:
runs-on: windows-2022
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip appx]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install:
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- run: npm un node-pty serialport
- run: npm i
- run: npm i -S -E node-pty@1.1.0-beta14
- run: npm i -S -E serialport@13.0.0
- name: Install R2 dependencies if store upload may run
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
run: node build/bin/build-win-appx
+68
View File
@@ -0,0 +1,68 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win-arm
on:
push:
branches: [ build, test, build-only, win-arm ]
jobs:
build:
runs-on: windows-11-arm
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip win-arm]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install:
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- run: npm un node-pty serialport
- run: npm i
- run: npm i -S -E node-pty@1.1.0-beta14
- run: npm i -S -E serialport@13.0.0
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
# check work/app/node_modules size in windows arm
- name: Check node_modules size
shell: powershell
run: |
$size = (Get-ChildItem -Path "work/app/node_modules" -Recurse | Measure-Object -Property Length -Sum).Sum
$sizeInMB = [math]::Round($size / 1MB, 2)
$sizeInGB = [math]::Round($size / 1GB, 2)
Write-Host "work/app/node_modules size: $sizeInMB MB ($sizeInGB GB)"
- name: build
if: ${{ !contains(github.event.head_commit.message, 'skip build') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-win-arm
+60
View File
@@ -0,0 +1,60 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win-loose
on:
push:
branches: [ build, test, build-only, win-loose ]
jobs:
build:
runs-on: windows-2022
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip loose]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install:
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- run: npm un node-pty serialport
- run: npm i
- run: npm i -S -E node-pty@1.1.0-beta14
- run: npm i -S -E serialport@13.0.0
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-win-loose
+68
View File
@@ -0,0 +1,68 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win-arm-nsis
on:
push:
branches: [ build, test, build-only, win-nsis-arm ]
jobs:
build:
runs-on: windows-11-arm
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip win-nsis-arm]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install:
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- run: npm un node-pty serialport
- run: npm i
- run: npm i -S -E node-pty@1.1.0-beta14
- run: npm i -S -E serialport@13.0.0
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
# check work/app/node_modules size in windows arm
- name: Check node_modules size
shell: powershell
run: |
$size = (Get-ChildItem -Path "work/app/node_modules" -Recurse | Measure-Object -Property Length -Sum).Sum
$sizeInMB = [math]::Round($size / 1MB, 2)
$sizeInGB = [math]::Round($size / 1GB, 2)
Write-Host "work/app/node_modules size: $sizeInMB MB ($sizeInGB GB)"
- name: build
if: ${{ !contains(github.event.head_commit.message, 'skip build') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-win-nsis-arm
+60
View File
@@ -0,0 +1,60 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win-nsis
on:
push:
branches: [ build, test, build-only, win-nsis ]
jobs:
build:
runs-on: windows-2022
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip nsis]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install:
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- run: npm un node-pty serialport
- run: npm i
- run: npm i -S -E node-pty@1.1.0-beta14
- run: npm i -S -E serialport@13.0.0
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-win-nsis
+59
View File
@@ -0,0 +1,59 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win-portable
on:
push:
branches: [ build, test, build-only, win-portable ]
jobs:
build:
runs-on: windows-2022
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip portable]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install:
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- run: npm un node-pty serialport
- run: npm i
- run: npm i -S -E node-pty@1.1.0-beta14
- run: npm i -S -E serialport@13.0.0
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-win-portable
+59
View File
@@ -0,0 +1,59 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win-tar
on:
push:
branches: [ build, test, build-only, win-tar ]
jobs:
build:
runs-on: windows-2022
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip win-tar]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24.x
uses: actions/setup-node@v4
with:
node-version: 24.x
- uses: actions/setup-python@v5
with:
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install:
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- run: npm un node-pty serialport
- run: npm i
- run: npm i -S -E node-pty@1.1.0-beta14
- run: npm i -S -E serialport@13.0.0
- name: Install R2 dependencies if needed fix
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-win-tar
+73
View File
@@ -0,0 +1,73 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: win7-tar
on:
push:
branches: [ build, test, build-only, win7-tar, legacy-build ]
jobs:
build:
runs-on: windows-2022
environment: build
if: ${{ !contains(github.event.head_commit.message, '[skip build]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip win]') && !contains(github.event.head_commit.message, '[skip win7-tar]') }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- uses: actions/setup-python@v5
with:
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: npm config set legacy-peer-deps true
- run: npm install -g node-gyp
# before_install :
# - run: npm install --global --production windows-build-tools --vs2015
- run: npm install -g yarn
- name: Update electron version and remove package-lock
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.devDependencies.electron = '22.3.27';
pkg.devDependencies['electron-builder'] = '26.0.20';
pkg.devDependencies['@electron/rebuild'] = '3.7.2';
pkg.dependencies['node-pty'] = '1.1.0-beta14';
pkg.dependencies.serialport = '13.0.0';
pkg.devDependencies.vite = '4';
pkg.devDependencies['@vitejs/plugin-react'] = '4.7.0';
pkg.dependencies['os-locale-s'] = '1.0.8';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
fs.unlinkSync('package-lock.json');
"
- run: npm i
- run: npm i -S @electron/rebuild@3.7.2
- name: Install R2 dependencies if needed
if: ${{ contains(github.event.head_commit.message, '[r2]') }}
run: npm i -D @aws-sdk/client-s3
# script:
- run: npm run b
- name: Run pb
run: npm run pb
- name: build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ secrets.BUILD_NUMBER }}
WORKFLOW_NAME: ${{ github.workflow }}
CF_R2_ACCOUNT_ID: ${{ secrets.CF_R2_ACCOUNT_ID }}
CF_R2_BUCKET: ${{ secrets.CF_R2_BUCKET }}
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_SECRET_ACCESS_KEY }}
run: node build/bin/build-win7-tar
+17
View File
@@ -0,0 +1,17 @@
name: Publish to WinGet
on:
release:
types: [released]
push:
branches: [ test-winget ]
jobs:
publish:
runs-on: ubuntu-24.04
environment: build
steps:
- uses: vedantmgoyal9/winget-releaser@main
with:
identifier: electerm.electerm
installers-regex: 'win-x64-installer.exe$'
max-versions-to-keep: 30
token: ${{ secrets.WINGET_TOKEN }}