-
-
Notifications
You must be signed in to change notification settings - Fork 19
82 lines (72 loc) · 2.52 KB
/
Incremental-update.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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