From e7d001e493e120afc81fcbb7331e582410db1551 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 20:52:41 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9github=20actions?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 44cb3f0..55bdd80 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,11 +18,13 @@ jobs: uses: actions/setup-node@v3.0.0 with: node-version: '16' - - name: Pnpm install and build + - name: Yarn install and build run: | - pnpm install --registry https://registry.npmmirror.com --dir ./frontend - echo "Build frontend..." - cd ./frontend && pnpm run build + cd frontend && rm -f yarn.lock && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps + yarn build +# pnpm install --registry https://registry.npmmirror.com --dir ./frontend +# echo "Build frontend..." +# cd ./frontend && pnpm run build - name: upload frontend release uses: actions/upload-artifact@v2 with: From 0d19b3bcce6d2563138f17c3e48e34ebf641edf4 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 21:11:54 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=96=B0=E5=A2=9Epnpm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 55bdd80..6a98f35 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,13 +18,14 @@ jobs: uses: actions/setup-node@v3.0.0 with: node-version: '16' - - name: Yarn install and build + - name: Pnpm install and build run: | - cd frontend && rm -f yarn.lock && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps - yarn build -# pnpm install --registry https://registry.npmmirror.com --dir ./frontend -# echo "Build frontend..." -# cd ./frontend && pnpm run build + npm install -g pnpm +# cd frontend && rm -f yarn.lock && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps +# yarn build + pnpm install --registry https://registry.npmmirror.com --dir ./frontend + echo "Build frontend..." + cd ./frontend && pnpm run build - name: upload frontend release uses: actions/upload-artifact@v2 with: From 200280e283483df3871d86fdc6f99c0acf9951bc Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 21:13:31 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BD=BF=E7=94=A8pnpm=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6a98f35..0fc8d49 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -21,11 +21,12 @@ jobs: - name: Pnpm install and build run: | npm install -g pnpm -# cd frontend && rm -f yarn.lock && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps -# yarn build pnpm install --registry https://registry.npmmirror.com --dir ./frontend echo "Build frontend..." cd ./frontend && pnpm run build +# cd frontend && rm -f yarn.lock && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps +# yarn build + - name: upload frontend release uses: actions/upload-artifact@v2 with: From e3aed8b812e005abfd84297cadcb4b1f6fd29f7c Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 21:15:11 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9node=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0fc8d49..561aa5a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,7 +17,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v3.0.0 with: - node-version: '16' + node-version: '18.12' - name: Pnpm install and build run: | npm install -g pnpm From e620c22167ac3bf38b75c617c543ce9d7b5f7eda Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 22:26:51 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 7 ++----- scripts/docker_build.sh | 6 +++++- scripts/docker_publish.sh | 8 ++++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 561aa5a..36cf420 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -24,9 +24,6 @@ jobs: pnpm install --registry https://registry.npmmirror.com --dir ./frontend echo "Build frontend..." cd ./frontend && pnpm run build -# cd frontend && rm -f yarn.lock && yarn install --registry https://registry.npmmirror.com --legacy-peer-deps -# yarn build - - name: upload frontend release uses: actions/upload-artifact@v2 with: @@ -60,7 +57,7 @@ jobs: uses: goreleaser/goreleaser-action@v3.1.0 with: version: latest - args: release --rm-dist + args: release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - name: upload release @@ -92,7 +89,7 @@ jobs: password: ${{ secrets.DOCKER_TOKEN }} - name: build - run: cd scripts && ./docker_publish.sh + run: cd scripts && ./docker_publish.sh "" "backend" # # - name: push image # run: | diff --git a/scripts/docker_build.sh b/scripts/docker_build.sh index 3e7b2b5..9b13d13 100755 --- a/scripts/docker_build.sh +++ b/scripts/docker_build.sh @@ -6,8 +6,12 @@ cd "$(dirname "$0")/../" LOCAL_PATH=$(pwd) ARCH=$1 User=$2 +BuildMode=$3 +if [[ "${BuildMode}" == "" ]];then + BuildMode="all" +fi # 编译可执行文件 -./scripts/build.sh "cmd" "" "all" ${ARCH} +./scripts/build.sh "cmd" "" "${BuildMode}" ${ARCH} source ./scripts/common.sh APP="apipark" diff --git a/scripts/docker_publish.sh b/scripts/docker_publish.sh index 0b6907b..3351dd1 100755 --- a/scripts/docker_publish.sh +++ b/scripts/docker_publish.sh @@ -12,15 +12,19 @@ App="apipark" if [[ "${User}" == "" ]];then User="eolinker" fi +BuildMode=$2 +if [[ "${BuildMode}" == "" ]];then + BuildMode="all" +fi Version=$(gen_version) ImageName="${User}/${App}" echo "docker manifest rm \"${ImageName}:${Version}\"" docker manifest rm "${ImageName}:${Version}" set -e -./scripts/docker_build.sh amd64 +./scripts/docker_build.sh amd64 "" "${BuildMode}" -./scripts/docker_build.sh arm64 +./scripts/docker_build.sh arm64 "" "${BuildMode}" From fcbe63a7f5d21c379d9f71b702f12e5ad5a24e54 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 22:32:20 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9shell=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/build.sh | 2 +- scripts/common.sh | 2 +- scripts/docker_build.sh | 2 +- scripts/docker_publish.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 4a2ee57..18c9c62 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash cd "$(dirname "$0")/../" LOCAL_PATH=$(pwd) diff --git a/scripts/common.sh b/scripts/common.sh index f5a0aed..e334dd5 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # =========================================================================== # File: common.sh diff --git a/scripts/docker_build.sh b/scripts/docker_build.sh index 9b13d13..aec2518 100755 --- a/scripts/docker_build.sh +++ b/scripts/docker_build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e diff --git a/scripts/docker_publish.sh b/scripts/docker_publish.sh index 3351dd1..a2fc04e 100755 --- a/scripts/docker_publish.sh +++ b/scripts/docker_publish.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash From 1863ef11a9920b0f02510729471a17e1165be2a5 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 22:40:14 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 4 ++-- .goreleaser.yaml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 36cf420..27e5686 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -56,8 +56,8 @@ jobs: - name: Create archives on Release #创建各种系统架构下的二进制包并上传至release assets uses: goreleaser/goreleaser-action@v3.1.0 with: - version: latest - args: release + version: 1.9.2 + args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - name: upload release diff --git a/.goreleaser.yaml b/.goreleaser.yaml index caf5ebc..f424549 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,4 +1,5 @@ # .goreleaser.yml +#version: 2 dist: build builds: From a97d51960666be76874c67f5c7fd907c40a491d7 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 22:42:20 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 18c9c62..c67004c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -53,12 +53,12 @@ env_check() { fi echo "Npm is installed." - # 检查是否安装了 pnpm - if ! command -v pnpm &> /dev/null; then - echo_error "Pnpm is not installed. Please install Pnpm." - exit 1 - fi - echo "Pnpm is installed." +# # 检查是否安装了 pnpm +# if ! command -v pnpm &> /dev/null; then +# echo_error "Pnpm is not installed. Please install Pnpm." +# exit 1 +# fi +# echo "Pnpm is installed." # 如果所有检查都通过,打印环境检查通过的消息 echo_info "All required tools are installed." From 67421bb128bcee1e662d1dc3b36a2418bed7ab91 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 23:13:32 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/docker_build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/docker_build.sh b/scripts/docker_build.sh index aec2518..2a43ba8 100755 --- a/scripts/docker_build.sh +++ b/scripts/docker_build.sh @@ -16,7 +16,8 @@ fi source ./scripts/common.sh APP="apipark" -cp cmd/${APP} scripts/cmd/ + +mkdir -p scripts/cmd/ && cp cmd/${APP} scripts/cmd/ VERSION=$(gen_version) From faeb9a3ddc8767089bf28740029ef9b27d1eb174 Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Tue, 25 Jun 2024 23:42:44 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 27e5686..c6c0038 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -89,7 +89,7 @@ jobs: password: ${{ secrets.DOCKER_TOKEN }} - name: build - run: cd scripts && ./docker_publish.sh "" "backend" + run: cd scripts && ./docker_publish.sh ${{ secrets.DOCKER_USERNAME }} "backend" # # - name: push image # run: | From e24c2c83acc056e6123641eb45389e81637b58ff Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Wed, 26 Jun 2024 00:00:36 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/docker_publish.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/docker_publish.sh b/scripts/docker_publish.sh index a2fc04e..c899b17 100755 --- a/scripts/docker_publish.sh +++ b/scripts/docker_publish.sh @@ -22,9 +22,9 @@ echo "docker manifest rm \"${ImageName}:${Version}\"" docker manifest rm "${ImageName}:${Version}" set -e -./scripts/docker_build.sh amd64 "" "${BuildMode}" +./scripts/docker_build.sh amd64 ${User} "${BuildMode}" -./scripts/docker_build.sh arm64 "" "${BuildMode}" +./scripts/docker_build.sh arm64 ${User} "${BuildMode}"