-
Notifications
You must be signed in to change notification settings - Fork 8
50 lines (50 loc) · 1.84 KB
/
main.yml
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
on:
workflow_dispatch
jobs:
exist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
with:
script: |
const fs = require('fs')
var path = require('path');
const execSync = require('child_process').execSync;
var walk = function(dir, done) {
var results = [];
fs.readdir(dir, function(err, list) {
if (err) return done(err);
var i = 0;
(function next() {
var file = list[i++];
if (!file) return done(null, results);
file = path.resolve(dir, file);
fs.stat(file, function(err, stat) {
if (stat && stat.isDirectory()) {
walk(file, function(err, res) {
results = results.concat(res);
next();
});
} else {
results.push(file);
next();
}
});
})();
});
};
function compilation(n, files){
let file = {};
for(let i in files){
let d = fs.readFileSync(files[i], "utf-8");
d = Buffer.from(d, 'utf-8').toString('base64');
file[i.split("bunker-v1/public/")[1]] = d;
}
fs.writeFileSync(path.join(process.env.GITHUB_WORKSPACE, "update.js"), JSON.stringify(file));
}
walk(path.join(process.env.GITHUB_WORKSPACE, "public"), compilation);
- uses: stefanzweifel/git-auto-commit-action@v4
with:
token: ${{ secrets.PAT }}
commit_message: Build updater files