mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 05:56:38 +08:00
调整CI
This commit is contained in:
@@ -21,12 +21,6 @@ env:
|
||||
FRONTEND_BUILD_COMMAND: pnpm build:embed
|
||||
FRONTEND_OUT_DIR: frontend/out
|
||||
EMBED_DIST_DIR: internal/router/dist
|
||||
EXTRA_FILES: |
|
||||
LICENSE
|
||||
README.md
|
||||
README_zh.md
|
||||
config.example.yaml
|
||||
DEPLOYMENT_zh.md
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -158,19 +152,16 @@ jobs:
|
||||
include:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
archive: tar.gz
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
archive: tar.gz
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
archive: tar.gz
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
archive: tar.gz
|
||||
- goos: windows
|
||||
goarch: amd64
|
||||
archive: zip
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -204,7 +195,7 @@ jobs:
|
||||
|
||||
build_args=(
|
||||
-trimpath
|
||||
-ldflags "$GO_LDFLAGS"
|
||||
-ldflags "$GO_LDFLAGS -X github.com/Rain-kl/Wavelet/internal/cmd.Version=$VERSION"
|
||||
-o "dist/$binary_name"
|
||||
)
|
||||
|
||||
@@ -214,42 +205,25 @@ jobs:
|
||||
|
||||
go build "${build_args[@]}" "$GO_MAIN"
|
||||
|
||||
- name: Package artifact
|
||||
- name: Rename binary for release
|
||||
id: package
|
||||
shell: bash
|
||||
env:
|
||||
VERSION: ${{ needs.create-release.outputs.version }}
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
ARCHIVE_FORMAT: ${{ matrix.archive }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
package_name="${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}"
|
||||
staging_dir="dist/$package_name"
|
||||
mkdir -p "$staging_dir"
|
||||
|
||||
if [[ "$GOOS" == "windows" ]]; then
|
||||
cp "dist/${APP_NAME}.exe" "$staging_dir/"
|
||||
src="dist/${APP_NAME}.exe"
|
||||
artifact="dist/${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}.exe"
|
||||
else
|
||||
cp "dist/${APP_NAME}" "$staging_dir/"
|
||||
fi
|
||||
|
||||
while IFS= read -r extra_file; do
|
||||
[[ -z "$extra_file" ]] && continue
|
||||
if [[ -e "$extra_file" ]]; then
|
||||
cp -R "$extra_file" "$staging_dir/"
|
||||
fi
|
||||
done <<< "$EXTRA_FILES"
|
||||
|
||||
if [[ "$ARCHIVE_FORMAT" == "zip" ]]; then
|
||||
(cd dist && zip -r "${package_name}.zip" "$package_name")
|
||||
artifact="dist/${package_name}.zip"
|
||||
else
|
||||
tar -C dist -czf "dist/${package_name}.tar.gz" "$package_name"
|
||||
artifact="dist/${package_name}.tar.gz"
|
||||
src="dist/${APP_NAME}"
|
||||
artifact="dist/${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}"
|
||||
fi
|
||||
|
||||
mv "$src" "$artifact"
|
||||
echo "artifact=$artifact" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload release artifact
|
||||
|
||||
@@ -48,7 +48,8 @@ changed=0
|
||||
|
||||
find_go_files() {
|
||||
find . \
|
||||
\( -path './.git' \
|
||||
\( -path './.*' \
|
||||
-o -path './docs' \
|
||||
-o -path './frontend/node_modules' \
|
||||
-o -path './frontend/.next' \
|
||||
-o -path './frontend/out' \
|
||||
|
||||
Reference in New Issue
Block a user