ci: 修改github release镜像源

This commit is contained in:
shanmite 2022-10-29 20:05:10 +08:00
parent 98948ad7f0
commit 989f836ba2
4 changed files with 45 additions and 43 deletions

View File

@ -53,27 +53,27 @@ 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: 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

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ lottery_info/
dist/
.env
*.log
*.zip
package-lock.json
env.js
my_config.js

View File

@ -4,19 +4,21 @@ WORKDIR /root/lottery
COPY . .
RUN npm config set registry https://registry.npm.taobao.org && npm i
# RUN npm config set registry https://registry.npm.taobao.org && npm i
RUN 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 \
ENV DOWNLOAD_HOST=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-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 ."]
npx pkg -t node$NODEV-linux-arm64 -o dist/lottery-auto-script-node$NODEV-linux-arm64 ."]

View File

@ -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
})