mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 23:41:12 +08:00
fix back release.yml to old version (#16160)
### What problem does this PR solve? As title ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
97
.github/workflows/release.yml
vendored
97
.github/workflows/release.yml
vendored
@@ -9,7 +9,6 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*" # normal release
|
||||
- 'nightly' # mutable tag
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -25,7 +24,6 @@ concurrency:
|
||||
jobs:
|
||||
release:
|
||||
runs-on: [ "self-hosted", "ragflow-release" ]
|
||||
|
||||
steps:
|
||||
- name: Ensure workspace ownership
|
||||
run: echo "chown -R ${USER} ${GITHUB_WORKSPACE}" && sudo chown -R ${USER} ${GITHUB_WORKSPACE}
|
||||
@@ -38,13 +36,6 @@ jobs:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
# https://github.com/actions/setup-go
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
|
||||
- name: Prepare release body
|
||||
run: |
|
||||
if [[ ${GITHUB_EVENT_NAME} != "schedule" ]]; then
|
||||
@@ -60,10 +51,8 @@ jobs:
|
||||
PRERELEASE=true
|
||||
echo "Workflow triggered by schedule"
|
||||
fi
|
||||
|
||||
echo "RELEASE_TAG=${RELEASE_TAG}" >> ${GITHUB_ENV}
|
||||
echo "PRERELEASE=${PRERELEASE}" >> ${GITHUB_ENV}
|
||||
|
||||
RELEASE_DATETIME=$(date --rfc-3339=seconds)
|
||||
echo Release ${RELEASE_TAG} created from ${GITHUB_SHA} at ${RELEASE_DATETIME} > release_body.md
|
||||
|
||||
@@ -83,93 +72,15 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Build Go CLI release binaries
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
CLI_NAME="ragflow_cli"
|
||||
|
||||
CLI_MAIN="./cmd/ragflow_cli.go"
|
||||
|
||||
DIST_DIR="dist/cli"
|
||||
|
||||
mkdir -p "${DIST_DIR}"
|
||||
|
||||
if [[ ! -e "${CLI_MAIN}" ]]; then
|
||||
echo "::error::Go CLI entry does not exist: ${CLI_MAIN}"
|
||||
echo "::error::Please update CLI_MAIN in .github/workflows/release.yml"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building Go CLI release binaries"
|
||||
echo "CLI name: ${CLI_NAME}"
|
||||
echo "CLI main: ${CLI_MAIN}"
|
||||
echo "Release tag: ${RELEASE_TAG}"
|
||||
echo "Commit: ${GITHUB_SHA}"
|
||||
|
||||
OFFICE_OXIDE_PREFIX="${OFFICE_OXIDE_PREFIX:-${HOME}/.office_oxide}"
|
||||
echo "office_oxide prefix: ${OFFICE_OXIDE_PREFIX}"
|
||||
|
||||
build_one() {
|
||||
local goos="$1"
|
||||
local goarch="$2"
|
||||
local ext="$3"
|
||||
|
||||
local output="${DIST_DIR}/${CLI_NAME}-${RELEASE_TAG}-${goos}-${goarch}${ext}"
|
||||
|
||||
echo "Building ${goos}/${goarch} -> ${output}"
|
||||
|
||||
CGO_ENABLED=1 \
|
||||
CGO_CFLAGS="-I${OFFICE_OXIDE_PREFIX}/include/office_oxide_c" \
|
||||
CGO_LDFLAGS="-L${OFFICE_OXIDE_PREFIX}/lib -loffice_oxide -Wl,-rpath,${OFFICE_OXIDE_PREFIX}/lib" \
|
||||
GOOS="${goos}" \
|
||||
GOARCH="${goarch}" \
|
||||
go build \
|
||||
-trimpath \
|
||||
-ldflags="-s -w -X main.version=${RELEASE_TAG} -X main.commit=${GITHUB_SHA}" \
|
||||
-o "${output}" \
|
||||
"${CLI_MAIN}"
|
||||
|
||||
if [[ "${goos}" != "windows" ]]; then
|
||||
chmod +x "${output}"
|
||||
fi
|
||||
}
|
||||
|
||||
build_one linux amd64 ""
|
||||
build_one linux arm64 ""
|
||||
build_one darwin amd64 ""
|
||||
build_one darwin arm64 ""
|
||||
build_one windows amd64 ".exe"
|
||||
build_one windows arm64 ".exe"
|
||||
|
||||
if command -v ldd >/dev/null 2>&1; then
|
||||
if ldd "${DIST_DIR}/${CLI_NAME}-${RELEASE_TAG}-linux-amd64" 2>&1 | tee /tmp/ragflow-cli-ldd.txt | grep -q "liboffice_oxide"; then
|
||||
echo "Verified linux/amd64 CLI links office_oxide"
|
||||
else
|
||||
echo "::error::linux/amd64 CLI does not link office_oxide"
|
||||
cat /tmp/ragflow-cli-ldd.txt || true
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "${DIST_DIR}"
|
||||
sha256sum * > SHA256SUMS
|
||||
cd -
|
||||
|
||||
echo "Generated CLI release assets:"
|
||||
ls -lh "${DIST_DIR}"
|
||||
|
||||
- name: Upload Go CLI release assets
|
||||
- name: Create or overwrite a release
|
||||
# https://github.com/actions/upload-release-asset has been replaced by https://github.com/softprops/action-gh-release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }} # Use the secret as an environment variable
|
||||
prerelease: ${{ env.PRERELEASE }}
|
||||
tag_name: ${{ env.RELEASE_TAG }}
|
||||
# The body field does not support environment variable substitution directly.
|
||||
body_path: release_body.md
|
||||
files: |
|
||||
dist/cli/*
|
||||
install.sh
|
||||
install.ps1
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user