ci: arm64 added, and optimized

This commit is contained in:
shanmite 2022-10-30 11:29:25 +08:00
parent b91a4f979d
commit 47e09a1263
3 changed files with 23 additions and 14 deletions

View File

@ -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
@ -55,13 +54,19 @@ jobs:
overwrite: true
arm64:
runs-on: ubuntu-latest
name: arm64
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 arm
npm run pkg "${{ matrix.platform }}-arm64"
- name: "Upload to artifact"
uses: actions/upload-artifact@v2
with:

View File

@ -1,14 +1,11 @@
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
RUN npm i
# ENV DOWNLOAD_HOST=https://ghproxy.com/https://github.com \
ENV DOWNLOAD_HOST=https://github.com \
ENV DOWNLOAD_HOST=https://ghproxy.com/https://github.com \
RELEASE_TAG=v3.4 \
NODEV=18.5.0 \
PKG_CACHE_PATH=/root/.pkg-cache \
@ -17,8 +14,10 @@ ENV DOWNLOAD_HOST=https://github.com \
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-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 [""]

View File

@ -24,13 +24,18 @@ if [[ -z "$1" ]]; then
fi
mkdir -p $TARGET_DIR
npm install
if [[ "$1" == *"arm"* ]]; then
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}/dist:/root/lottery/dist shanmite/pkg-arm64
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