mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8dbe5ea5a | ||
|
|
47e09a1263 | ||
|
|
b91a4f979d | ||
|
|
d9cecbe163 | ||
|
|
989f836ba2 |
+29
-25
@@ -37,7 +37,6 @@ jobs:
|
||||
node-version: "*"
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm install
|
||||
npm run pkg "node${{ matrix.nodev }}-${{ matrix.platform }}-x64"
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v2
|
||||
@@ -53,27 +52,32 @@ jobs:
|
||||
delete_file: "dist/*.zip"
|
||||
tag_name: "v2"
|
||||
overwrite: true
|
||||
# arm64:
|
||||
# runs-on: ubuntu-latest
|
||||
# name: arm64
|
||||
# steps:
|
||||
# - name: "Checkout codes"
|
||||
# uses: actions/checkout@v2
|
||||
# - name: "Pkg this"
|
||||
# run: |
|
||||
# sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
# npm run pkg arm
|
||||
# - name: "Upload to artifact"
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: arm64
|
||||
# path: "dist/*.zip"
|
||||
# - name: "Upload to release draft"
|
||||
# uses: xresloader/upload-to-github-release@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
# with:
|
||||
# file: "dist/*.zip"
|
||||
# delete_file: "dist/*.zip"
|
||||
# tag_name: "v2"
|
||||
# overwrite: true
|
||||
arm64:
|
||||
runs-on: ubuntu-latest
|
||||
name: node18-${{ matrix.platform }}-arm64
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux
|
||||
- platform: linuxstatic
|
||||
- platform: alpine
|
||||
steps:
|
||||
- name: "Checkout codes"
|
||||
uses: actions/checkout@v2
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm run pkg "${{ matrix.platform }}-arm64"
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: arm64
|
||||
path: "dist/*.zip"
|
||||
- name: "Upload to release draft"
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
with:
|
||||
file: "dist/*.zip"
|
||||
delete_file: "dist/*.zip"
|
||||
tag_name: "v2"
|
||||
overwrite: true
|
||||
|
||||
@@ -6,6 +6,7 @@ lottery_info/
|
||||
dist/
|
||||
.env
|
||||
*.log
|
||||
*.zip
|
||||
package-lock.json
|
||||
env.js
|
||||
my_config.js
|
||||
@@ -1,5 +1,13 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
## 主要变化(2.6.5)
|
||||
* 47e09a1 ci: arm64 added, and optimized
|
||||
* b91a4f9 fix: `fs.rm` node12
|
||||
* d9cecbe ci: push shanmite/pkg-arm64
|
||||
* 989f836 ci: 修改github release镜像源
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.6.4)
|
||||
* a363b4e ci: 关闭`arm64`自动打包
|
||||
* c220ff5 feat(多账号优化): 抽奖信息本地保存 (#209)
|
||||
|
||||
+16
-15
@@ -1,22 +1,23 @@
|
||||
FROM arm64v8/node
|
||||
FROM arm64v8/node:lts-alpine
|
||||
|
||||
WORKDIR /root/lottery
|
||||
|
||||
COPY . .
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
|
||||
apk add --no-cache curl
|
||||
|
||||
RUN npm config set registry https://registry.npm.taobao.org && npm i
|
||||
|
||||
ENV DOWNLOAD_HOST=https://download.fastgit.org \
|
||||
RELEASE_TAG=v3.4 \
|
||||
NODEV=18.5.0 \
|
||||
PKG_CACHE_PATH=/root/.pkg-cache \
|
||||
PKG_IGNORE_TAG=true
|
||||
ENV DOWNLOAD_HOST=https://ghproxy.com/https://github.com \
|
||||
RELEASE_TAG=v3.4 \
|
||||
NODEV=18.5.0 \
|
||||
PKG_CACHE_PATH=/root/.pkg-cache \
|
||||
PKG_IGNORE_TAG=true
|
||||
|
||||
RUN mkdir -p "${PKG_CACHE_PATH}" && \
|
||||
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linux-arm64" -o \
|
||||
"${PKG_CACHE_PATH}/fetched-v$NODEV-linux-arm64" && \
|
||||
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linuxstatic-arm64" -o \
|
||||
"${PKG_CACHE_PATH}/fetched-v$NODEV-linuxstatic-arm64"
|
||||
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linux-arm64" -o \
|
||||
"${PKG_CACHE_PATH}/fetched-v$NODEV-linux-arm64" && \
|
||||
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-alpine-arm64" -o \
|
||||
"${PKG_CACHE_PATH}/fetched-v$NODEV-alpine-arm64" && \
|
||||
curl -L "$DOWNLOAD_HOST/vercel/pkg-fetch/releases/download/$RELEASE_TAG/node-v$NODEV-linuxstatic-arm64" -o \
|
||||
"${PKG_CACHE_PATH}/fetched-v$NODEV-linuxstatic-arm64"
|
||||
|
||||
CMD ["bash", "-c", "npx pkg -t node$NODEV-linuxstatic-arm64 -o dist/lottery-auto-script-node$NODEV-linuxstatic-arm64 . && \
|
||||
npx pkg -t node$NODEV-linux-arm64 -o dist/lottery-auto-script-node$NODEV-linux-arm64 ."]
|
||||
ENTRYPOINT ["npx", "pkg"]
|
||||
CMD [""]
|
||||
|
||||
+7
-8
@@ -65,17 +65,16 @@ async function update() {
|
||||
.filter(({ name }) => checkPlatform(name))
|
||||
.map(({ browser_download_url }) => browser_download_url)
|
||||
if (download_url.length) {
|
||||
const proxy_host = ['download.fastgit.org']
|
||||
await try_for_each(download_url.entries(), async ([i, url]) => {
|
||||
let proxy_url = new URL(url)
|
||||
proxy_url.host = proxy_host[0]
|
||||
log.warn('自动下载', `切换代理${proxy_host[0]}`)
|
||||
await download(proxy_url.href, `latest_version${i}.zip`)
|
||||
let proxy_url = "https://ghproxy.com/";
|
||||
proxy_url += url
|
||||
log.warn('自动下载', `切换代理${proxy_url}`)
|
||||
await download(proxy_url, `latest_version${i}.zip`)
|
||||
.catch(async err => {
|
||||
log.error('自动下载', err)
|
||||
proxy_url.host = 'github.com'
|
||||
log.warn('自动下载', `使用原始链接github.com`)
|
||||
await download(proxy_url.href, `latest_version${i}.zip`)
|
||||
proxy_url = url
|
||||
log.warn('自动下载', `使用原始链接${proxy_url}`)
|
||||
await download(proxy_url, `latest_version${i}.zip`)
|
||||
})
|
||||
return false
|
||||
})
|
||||
|
||||
+20
-3
@@ -370,6 +370,25 @@ const utils = {
|
||||
})
|
||||
});
|
||||
},
|
||||
/**
|
||||
* deleteFolderRecursive
|
||||
* @param {*} url
|
||||
*/
|
||||
deleteFolderRecursive(url) {
|
||||
var files = [];
|
||||
if (fs.existsSync(url)) {
|
||||
files = fs.readdirSync(url);
|
||||
files.forEach(function (file) {
|
||||
var curPath = path.join(url, file);
|
||||
if (fs.statSync(curPath).isDirectory()) {
|
||||
utils.deleteFolderRecursive(curPath);
|
||||
} else {
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
fs.rmdirSync(url);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 读取dyid文件
|
||||
* @param {number} num
|
||||
@@ -433,9 +452,7 @@ const utils = {
|
||||
* 清空lottery_info
|
||||
*/
|
||||
clearLotteryInfo() {
|
||||
return new Promise((resolve) => {
|
||||
fs.rm(utils.lottery_info_dir, { recursive: true, force: true }, resolve)
|
||||
});
|
||||
utils.deleteFolderRecursive(utils.lottery_info_dir)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -158,13 +158,13 @@ function initConfig() {
|
||||
log.warn('结束运行', '5秒后自动退出');
|
||||
await delay(5 * 1000);
|
||||
} else {
|
||||
await clearLotteryInfo();
|
||||
clearLotteryInfo();
|
||||
while (loop_wait) {
|
||||
log.info('程序休眠', `${loop_wait / 1000}秒后再次启动`)
|
||||
await delay(loop_wait)
|
||||
if (initEnv() || initConfig()) return;
|
||||
await main()
|
||||
await clearLotteryInfo();
|
||||
clearLotteryInfo();
|
||||
}
|
||||
log.info('结束运行', '未在config.js中设置休眠时间')
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.6.4",
|
||||
"version": "2.6.5",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
+8
-3
@@ -24,13 +24,18 @@ if [[ -z "$1" ]]; then
|
||||
fi
|
||||
|
||||
mkdir -p $TARGET_DIR
|
||||
npm install
|
||||
|
||||
if [[ "$1" == *"arm"* ]]; then
|
||||
podman build -f Dockerfile.pkg-arm64 -t pkg-arm64
|
||||
podman run -it --rm -v ${PWD}/dist:/root/lottery/dist pkg-arm64
|
||||
OUTFILE="$TARGET_DIR/lottery-auto-script-node18-$1"
|
||||
sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
podman run -it \
|
||||
--rm \
|
||||
-v ${PWD}:/root/lottery \
|
||||
shanmite/pkg-arm64 -t "node18.5.0-$1" -o "$OUTFILE" .
|
||||
elif [[ "$1" == *"x64"* ]]; then
|
||||
OUTFILE="$TARGET_DIR/lottery-auto-script-$1"
|
||||
npx pkg -t "$1" -o $OUTFILE .
|
||||
npx pkg -t "$1" -o "$OUTFILE" .
|
||||
fi
|
||||
|
||||
for file in "$TARGET_DIR/"*; do
|
||||
|
||||
Reference in New Issue
Block a user