Skip to content

更新 pr.yml

更新 pr.yml #9

Workflow file for this run

name: Create Artifact
on:
push
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-pc-windows-msvc
default: true
- name: Cache
id: cache
uses: actions/cache@v2.1.6
with:
path: node_modules
key: buildCachev25
- name: Cache
id: cache2
uses: actions/cache@v2.1.6
with:
path: Mod Manager/node_modules
key: buildCache2v20
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install
- name: Prep
run: |
npm install -g pkg typescript @napi-rs/cli
- name: Build Rust code
run: |
cd rust
yarn
yarn build
cd ../
copy ./rust/index.d.ts ./src/smf-rust.d.ts
copy ./rust/rust.win32-x64-msvc.node ./src/smf-rust.node
- name: Build EXE
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: |
New-Item -ItemType Directory -Force -Path ./node_modules/piscina
robocopy ./piscina ./node_modules/piscina /E /is /it; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
tsc
copy ./src/smf-rust.node ./compiled/smf-rust.node
pkg package.json --targets node18-win-x64 --output Deploy.exe --compress Brotli
- name: Install GUI dependencies
if: steps.cache2.outputs.cache-hit != 'true'
run: |
cd "Mod Manager"
npm install
cd ../
- name: Build GUI
run: |
cd "Mod Manager"
npm run build
cd ../
- name: Ready for zip
run: |
New-Item -ItemType Directory dist
New-Item -ItemType Directory dist/Third-Party
New-Item -ItemType Directory dist/Info
New-Item -ItemType Directory dist/API
New-Item -ItemType Directory "dist/Mod Manager"
robocopy ./Third-Party ./dist/Third-Party /E; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy "./For Build" ./dist /E; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy ./docs ./dist/Info /E; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy ./compiled ./dist/API /E *.d.ts; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy ".\Mod Manager\dist\win-unpacked" "./dist/Mod Manager" /E; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
copy Deploy.exe dist
New-Item -Path dist -Name "Mod Manager.cmd" -ItemType "file" -Value "@echo off`ncd `"Mod Manager`"`nstart `"`" `"Mod Manager.exe`""
- name: Zip
uses: TheDoctor0/zip-release@4fb9e4ff72847dd3d1c111cf63834e353ed7cb3d
with:
filename: Release.zip
directory: dist
- uses: actions/upload-artifact@v3
with:
name: Output
path: dist/Release.zip