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