+
Skip to content

Github Action自动打包完成 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ 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
pnpm install --registry https://registry.npmmirror.com --dir ./frontend
echo "Build frontend..."
cd ./frontend && pnpm run build
Expand Down Expand Up @@ -55,7 +56,7 @@ jobs:
- name: Create archives on Release #创建各种系统架构下的二进制包并上传至release assets
uses: goreleaser/goreleaser-action@v3.1.0
with:
version: latest
version: 1.9.2
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -88,7 +89,7 @@ jobs:
password: ${{ secrets.DOCKER_TOKEN }}

- name: build
run: cd scripts && ./docker_publish.sh
run: cd scripts && ./docker_publish.sh ${{ secrets.DOCKER_USERNAME }} "backend"
#
# - name: push image
# run: |
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# .goreleaser.yml
#version: 2
dist: build

builds:
Expand Down
14 changes: 7 additions & 7 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

cd "$(dirname "$0")/../"
LOCAL_PATH=$(pwd)
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion scripts/common.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# ===========================================================================
# File: common.sh
Expand Down
11 changes: 8 additions & 3 deletions scripts/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
#!/bin/sh
#!/bin/bash

set -e

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"

cp cmd/${APP} scripts/cmd/

mkdir -p scripts/cmd/ && cp cmd/${APP} scripts/cmd/

VERSION=$(gen_version)

Expand Down
10 changes: 7 additions & 3 deletions scripts/docker_publish.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash



Expand All @@ -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 ${User} "${BuildMode}"

./scripts/docker_build.sh arm64
./scripts/docker_build.sh arm64 ${User} "${BuildMode}"



Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载