diff --git a/.github/conf/.goreleaser.yml b/.github/conf/.goreleaser.yml index d27812d..02bdcd9 100644 --- a/.github/conf/.goreleaser.yml +++ b/.github/conf/.goreleaser.yml @@ -1,6 +1,7 @@ before: hooks: - go mod tidy + - builds: - binary: seamoon env: @@ -14,7 +15,7 @@ builds: - 6 - 7 ldflags: - - -s -w -X github.com/DVKunion/SeaMoon/pkg/consts.Version={{.Version}} + - -s -w -X github.com/DVKunion/SeaMoon/pkg/consts.Version={{.Version}} -X github.com/DVKunion/SeaMoon/pkg/consts.Commit={{.Sha}} checksum: name_template: 'checksums.txt' snapshot: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 97f41d0..632f164 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,11 +11,32 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Clone seamoon-web repository + uses: actions/checkout@v4 + with: + repository: 'DVKunion/seamoon-web' + ref: 'main' # Or any other branch or tag you want to checkout + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Install dependencies + run: | + npm install + - name: Build Front + run: | + npm run build + cp -r dist /tmp + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: 1.21 - name: Build - run: go build --ldflags "-s -w -X github.com/DVKunion/SeaMoon/pkg/consts.Version=${{github.ref_name}}" cmd/main.go - + run: | + cp -r /tmp/dist cmd/client/static + go mod tidy + go build -o seamoon -v --ldflags "-s -w -X github.com/DVKunion/SeaMoon/pkg/consts.Version=${{github.ref_name}} -X github.com/DVKunion/SeaMoon/pkg/consts.Commit=${{github.sha}}" cmd/main.go + - uses: actions/upload-artifact@v4 + with: + path: seamoon \ No newline at end of file diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 819460f..ccd588a 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -10,14 +10,14 @@ jobs: runs-on: ubuntu-20.04 if: startsWith(github.ref, 'refs/tags/') steps: - - uses: actions/checkout@v3 - - uses: docker/setup-qemu-action@v2 - - uses: docker/setup-buildx-action@v2 - - uses: docker/login-action@v2 + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - uses: docker/build-push-action@v3 + - uses: docker/build-push-action@v5 with: push: true platforms: | diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 27ce44e..a0924f5 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -16,9 +16,9 @@ jobs: node-version: [ 18.x ] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f0c7d2..cf61bde 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,16 +11,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: 1.21 id: go - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser version: latest diff --git a/.gitignore b/.gitignore index f660f40..4a6da87 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ *.crt *.key -dist/ +cmd/client/static/dist/* web/ *.log *.toml diff --git a/Dockerfile b/Dockerfile index 996adb5..963fd8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ COPY .. /src WORKDIR /src ENV CGO_ENABLED 0 ENV VERSION=${VERSION} -RUN go build -ldflags "-X github.com/DVKunion/SeaMoon/server/consts.Version=${VERSION}" -o /tmp/seamoon cmd/main.go +ENV SHA=${SHA} +RUN go build -ldflags "-X github.com/DVKunion/SeaMoon/server/consts.Version=${VERSION} -X github.com/DVKunion/SeaMoon/server/consts.Commit=${SHA}" -o /tmp/seamoon cmd/main.go RUN chmod +x /tmp/seamoon # run stage FROM alpine:3.19 diff --git a/README.md b/README.md index 747742a..c5d873b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ 月海之名取自于苏轼的《西江月·顷在黄州》,寓意月海取自于传统工具,用之于云,最终达到隐匿于海的效果。 -月海基于 Serverless 的动态特性、分别从网络层、应用层实现对应的能力,并利用serverless-devs工具来实现快捷的部署/跨厂商操作。 +月海基于 Serverless 的动态特性、分别从网络层、应用层实现对应的能力,并集成了SDK来实现快捷的部署/跨厂商操作。 想要了解更多,请移步 [官方手册](https://seamoon.dvkunion.cn) diff --git a/s.yaml b/s.yaml deleted file mode 100644 index 3c18c23..0000000 --- a/s.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# 阿里云函数FC部署 serverless-devs 脚本 -# 如需要部署其他云厂商, 请使用 `s deploy -t s.xxxx.yaml` -edition: 1.0.0 # 命令行YAML规范版本,遵循语义化版本(Semantic Versioning)规范 -name: SeaMoon-Server -access: "default" # 默认使用 `s config add` 添加密钥时,accessID的默认值 - -vars: - region: cn-hongkong # 部署区域,请看docs/DEPLOY.md - service: - name: SeaMoon-Service - description: "SeaMoon Service" - internetAccess: true -# logConfig: auto # 开启日志,注意日志服务是收费的,每月只有500MB的免费额度,如不需要(非debug)可以注释掉。 - -actions: - pre-deploy: - - run: wget https://github.com/DVKunion/SeaMoon/releases/download/1.2.0-beta.2/SeaMoon_1.2.0-beta.2_linux_amd64.tar.gz - path: ./ - - run: tar -zvxf SeaMoon_1.2.0-beta.2_linux_amd64.tar.gz - path: ./ - - run: chmod +x seamoon - path: ./ - -services: - SeaMoon-WST-Node: - component: fc - props: - region: ${vars.region} - service: ${vars.service} - function: - name: ws-node - description: 'websocket-proxy-server' - codeUri: './' - customRuntimeConfig: - command: - - ./seamoon - args: - - "server" - handler: main - instanceConcurrency: 10 - instanceType: e1 - cpu: 0.05 - diskSize: 512 - memorySize: 128 - runtime: custom - timeout: 300 - internetAccess: true - triggers: - - name: httpTrigger - type: http - config: - authType: anonymous - methods: - - GET - - POST - SeaMoon-GRT-Node: - component: fc - props: - region: ${vars.region} - service: ${vars.service} - function: - name: grpc-node - description: 'grpc-proxy-server' - codeUri: './' - caPort: 8089 - customRuntimeConfig: - command: - - ./seamoon - args: - - "server" - - "-p" - - "8089" - - "-t" - - "grpc" - handler: main - instanceConcurrency: 10 - instanceType: e1 - cpu: 0.05 - diskSize: 512 - memorySize: 128 - runtime: custom - timeout: 300 - internetAccess: true - triggers: - - name: httpTrigger - type: http - config: - authType: anonymous - methods: - - GET - - POST \ No newline at end of file