Update build-and-deploy-plugins.yml
This commit is contained in:
28
.github/workflows/build-and-deploy-plugins.yml
vendored
28
.github/workflows/build-and-deploy-plugins.yml
vendored
@@ -40,13 +40,15 @@ jobs:
|
|||||||
echo "📂 Deep list of Gerrit repo:"
|
echo "📂 Deep list of Gerrit repo:"
|
||||||
find gerrit-repo
|
find gerrit-repo
|
||||||
|
|
||||||
|
|
||||||
- name: Build Go plugins in Docker
|
- name: Build Go plugins in Docker
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
mkdir -p $PLUGIN_OUTPUT_DIR
|
mkdir -p $PLUGIN_OUTPUT_DIR github-repo/plugins-temp
|
||||||
|
|
||||||
BUILD_CMDS=""
|
BUILD_CMDS=""
|
||||||
|
|
||||||
# GitHub Plugins
|
# GitHub plugins
|
||||||
for dir in github-repo/pkg/plugin/implementation/*; do
|
for dir in github-repo/pkg/plugin/implementation/*; do
|
||||||
if [ -d "$dir/cmd" ]; then
|
if [ -d "$dir/cmd" ]; then
|
||||||
plugin=$(basename "$dir")
|
plugin=$(basename "$dir")
|
||||||
@@ -54,20 +56,19 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Copy Gerrit plugins into GitHub repo so they inherit its go.mod
|
||||||
for dir in gerrit-repo/plugins/*; do
|
for dir in gerrit-repo/plugins/*; do
|
||||||
if [ -d "$dir/cmd" ]; then
|
plugin=$(basename "$dir")
|
||||||
plugin=$(basename "$dir")
|
cp -r "$dir" "github-repo/plugins-temp/$plugin"
|
||||||
BUILD_CMDS+="cd $dir/cmd && go mod init temp/$plugin && go build -buildmode=plugin -o /app/${PLUGIN_OUTPUT_DIR}/${plugin}.so && cd - && "
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Gerrit Plugins (confirmed path: gerrit-repo/plugins/*/cmd)
|
# Build copied Gerrit plugins
|
||||||
#for dir in gerrit-repo/plugins/*; do
|
for dir in github-repo/plugins-temp/*; do
|
||||||
# if [ -d "$dir/cmd" ]; then
|
if [ -d "$dir/cmd" ]; then
|
||||||
# plugin=$(basename "$dir")
|
plugin=$(basename "$dir")
|
||||||
# BUILD_CMDS+="go build -buildmode=plugin -buildvcs=false -o ${PLUGIN_OUTPUT_DIR}/${plugin}.so ./${dir}/cmd && "
|
BUILD_CMDS+="cd github-repo && go build -buildmode=plugin -buildvcs=false -o ../${PLUGIN_OUTPUT_DIR}/${plugin}.so ./plugins-temp/${plugin}/cmd && cd - && "
|
||||||
# fi
|
fi
|
||||||
#done
|
done
|
||||||
|
|
||||||
BUILD_CMDS=${BUILD_CMDS%" && "}
|
BUILD_CMDS=${BUILD_CMDS%" && "}
|
||||||
echo "🛠️ Running build commands inside Docker:"
|
echo "🛠️ Running build commands inside Docker:"
|
||||||
@@ -75,6 +76,7 @@ jobs:
|
|||||||
|
|
||||||
docker run --rm -v "$(pwd)":/app -w /app golang:1.24-bullseye sh -c "$BUILD_CMDS"
|
docker run --rm -v "$(pwd)":/app -w /app golang:1.24-bullseye sh -c "$BUILD_CMDS"
|
||||||
|
|
||||||
|
|
||||||
- name: List zip output
|
- name: List zip output
|
||||||
run: |
|
run: |
|
||||||
ls -lh plugins_bundle.zip
|
ls -lh plugins_bundle.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user