From 052145154485fded2c11c6093130d3821d67c4d3 Mon Sep 17 00:00:00 2001 From: Star Date: Sun, 3 Aug 2025 18:35:56 +0800 Subject: [PATCH] update for gojs packages add docker image --- .gitea/workflows/docker_build.yml | 47 +++++++++++++++++++++++++++++++ .gitignore | 11 ++++++++ Dockerfile | 5 ++++ apigo.yml | 10 ++++++- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/docker_build.yml create mode 100644 .gitignore create mode 100644 Dockerfile diff --git a/.gitea/workflows/docker_build.yml b/.gitea/workflows/docker_build.yml new file mode 100644 index 0000000..bbf0061 --- /dev/null +++ b/.gitea/workflows/docker_build.yml @@ -0,0 +1,47 @@ +name: Build apigo + +on: + push: + tags: + - "v*" + +env: + IMAGE_NAME: apigo.cc/ag/apigo:${{ gitea.ref_name }} + IMAGE_LATEST: apigo.cc/ag/apigo:latest + +jobs: + build: + runs-on: ubuntu-latest + container: + image: apigo.cc/ag/ag:latest + steps: + - name: Build + run: | + mkdir apigo + cd apigo + sed -i "s/version: v0.0.1/version: ${{ gitea.ref_name }}/" apigo.yml + sed -i "s#Hello world#please mount app in /app/main.js, example: docker run --rm -it -v /your/app:/app apigo.cc/ag/apigo#" main.js + ag i + ag b + upx build/apigo_linux_amd64 + docker build -t ${{ env.IMAGE_NAME }} -t ${{ env.IMAGE_LATEST }} . + echo "${{ secrets.DOCKERPUSHKEY }}" | docker login apigo.cc -u "${{ gitea.actor }}" --password-stdin + docker push ${{ env.IMAGE_NAME }} + docker push ${{ env.IMAGE_LATEST }} + docker logout apigo.cc + + - name: Send notification + if: always() + run: | + BUILD_URL="https://apigo.cc/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}" + if [ "${{ success() }}" = "true" ]; then + CONTENT="✅发布并测试成功: ${{ env.REPO_NAME }}@${{ env.VERSION_TAG }}\n镜像: ${{ env.IMAGE_NAME }}\n构建地址: ${BUILD_URL}" + else + CONTENT="🚨发布并测试失败: ${{ env.REPO_NAME }}@${{ env.VERSION_TAG }}\n构建地址: ${BUILD_URL}" + fi + echo $CONTENT + + TIMESTAMP=$(date +%s)000 + STRING_TO_SIGN=$(printf "%s\n%s" "$TIMESTAMP" "${{ secrets.DINGSECRET }}") + SIGN=$(echo -n "$STRING_TO_SIGN" | openssl dgst -sha256 -hmac "${{ secrets.DINGSECRET }}" -binary | base64 | tr -d '\n' | sed -e 's/+/%2B/g' -e 's/\//%2F/g' -e 's/=/%3D/g') + curl -s -X POST "${{ secrets.DINGURL }}×tamp=${TIMESTAMP}&sign=${SIGN}" -H "Content-Type: application/json" -d "{\"msgtype\": \"text\",\"text\": {\"content\": \"${CONTENT}\"}}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e7c0fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.* +!.gitignore +!.gitea +go.sum +/env.yml +/tests +/node_modules +/package.json +/package-lock.json +/build +/release diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6909072 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:latest +COPY build/apigo_linux_amd64 /usr/local/bin/apigo +COPY main.js /app/ +workdir /app +entrypoint ["apigo"] diff --git a/apigo.yml b/apigo.yml index 01180f6..c021490 100644 --- a/apigo.yml +++ b/apigo.yml @@ -1,7 +1,7 @@ name: version: v0.0.1 main: main.js -#goproxy: https://goproxy.cn,direct +goproxy: https://goproxy.cn,direct target: darwin: amd64 arm64 linux: amd64 arm64 @@ -13,6 +13,14 @@ module: apigo.cc/gojs/file: latest apigo.cc/gojs/http: latest apigo.cc/gojs/db: latest + apigo.cc/gojs/office: latest + apigo.cc/gojs/task: latest + apigo.cc/gojs/mail: latest + apigo.cc/gojs/img: latest + apigo.cc/gojs/redis: latest + apigo.cc/gojs/runtime: latest + apigo.cc/gojs/service: latest + apigo.cc/gojs/client: latest modulealias: extraimport: cachefile: