Skip to content

Merge pull request #471 from Giftia/dev #38

Merge pull request #471 from Giftia/dev

Merge pull request #471 from Giftia/dev #38

name: Build Incremental Update Package On Windows (Windows 增量更新包)
on:
push:
branches:
- master
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js v18
uses: actions/setup-node@v4
with:
node-version: 18
architecture: x64
cache: 'npm'
cache-dependency-path: ./package-lock.json
- name: Remove conflicting files
shell: bash
run: rm -rf ./plugins/go-cqhttp/
- name: Clean Install Modules
run: |
npm ci --production
cd ./plugins/
rm package.json
rm package-lock.json
cd ..
- name: Install pkg Tool
run: npm i pkg -g
- name: Use pkg To Package
run: pkg -t node14-windows . --compress Brotli
- name: Declare VERSION
shell: bash
run: |
node -e "
const fs = require('fs');
const package = require('./package.json');
fs.writeFileSync('version-number', 'VERSION_NUMBER=v' + package.version);
"
cat ./version-number >> $GITHUB_ENV
- name: Pre-compress
shell: bash
run: |
npm i archiver
node -e "
const archiver = require('archiver');
const fs = require('fs');
const path = require('path');
const output = fs.createWriteStream(path.join(__dirname, 'ChatDACS-${{ env.VERSION_NUMBER }}_Update-Package.zip'));
const archive = archiver('zip', {
zlib: { level: 9 }
});
archive.pipe(output);
archive.directory('./plugins/', 'plugins');
archive.directory('./migrations/', 'migrations');
archive.file('./package.json', { name: 'package.json' });
archive.file('./chatdacs.exe', { name: 'chatdacs.exe' });
archive.finalize();
"
- name: Get Current Time
shell: bash
id: time
# set-output is deprecated: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
run: echo "now=$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: ChatDACS-${{ env.VERSION_NUMBER }}_Update-Package-${{ steps.time.outputs.now }}
path: ChatDACS-${{ env.VERSION_NUMBER }}_Update-Package.zip
if-no-files-found: error