diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..ec401036df --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,75 @@ +name: Build Filebrowser for Buckyos App + +on: + workflow_dispatch: + +jobs: + build-all-platforms: + name: Build All Platforms + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Write Identify File + run: | + mkdir -p ~/.buckycli + echo "${{secrets.NODE_IDENTIFY_BASE64}}" | base64 -d > ~/.buckycli/node_identity.json + echo "${{secrets.NODE_PRIVATE_KEY_BASE64}}" | base64 -d > ~/.buckycli/node_private_key.pem + echo "${{secrets.USER_CONFIG_BASE64}}" | base64 -d > ~/.buckycli/user_config.json + echo "${{secrets.USER_PRIVATE_KEY_BASE64}}" | base64 -d > ~/.buckycli/user_private_key.pem + - name: Download Buckycli + uses: actions/download-artifact@v5 + with: + name: buckyos-tools-linux-amd64-0.5.1+build260116 + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: buckyos/buckyos + run-id: 21052409212 + path: ${{github.workspace}} + - name: Check Buckycli and Identify Files + run: | + ls -la ~/.buckycli + ls -la ${{github.workspace}}/buckycli + chmod +x ${{github.workspace}}/buckycli + - uses: actions/setup-go@v6 + with: + go-version: '1.25' + - name: Install Task + uses: go-task/setup-task@v1 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: "latest" + - uses: actions/setup-node@v6 + with: + node-version: "24.x" + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Get Dapp Version + id: get_version + run: | + VERSION=$(python3 -c "import json; print(json.load(open('publish/app_pkg/pkg_meta.json'))['version'])") + echo "DAPP_VERSION=$VERSION" >> $GITHUB_OUTPUT + - name: Build Filebrowser Dapp + run: | + python3 build_dapp.py + - name: Pack Dapp + run: | + python3 pack_dapp.py + env: + BUCKYCLI_PATH: ${{github.workspace}}/buckycli + - name: Tar Dapp Package + run: | + tar -zvcf filebrowser.tar.gz -C /opt/buckyosci/apps buckyos_filebrowser + - name: Generate Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.get_version.outputs.DAPP_VERSION }} + name: filebrowser-${{ steps.get_version.outputs.DAPP_VERSION }} + generate_release_notes: true + fail_on_unmatched_files: true + files: filebrowser.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 846b08f8f1..0000000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,115 +0,0 @@ -name: Continuous Integration - -on: - push: - branches: - - "master" - tags: - - "v*" - pull_request: - -jobs: - lint-frontend: - name: Lint Frontend - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: pnpm/action-setup@v4 - with: - package_json_file: "frontend/package.json" - - uses: actions/setup-node@v6 - with: - node-version: "24.x" - cache: "pnpm" - cache-dependency-path: "frontend/pnpm-lock.yaml" - - working-directory: frontend - run: | - pnpm install --frozen-lockfile - pnpm run lint - - lint-backend: - name: Lint Backend - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - with: - go-version: "1.25.x" - - uses: golangci/golangci-lint-action@v9 - with: - version: "latest" - - test: - name: Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-go@v6 - with: - go-version: "1.25.x" - - run: go test --race ./... - - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - uses: actions/setup-go@v6 - with: - go-version: '1.25' - - uses: pnpm/action-setup@v4 - with: - package_json_file: "frontend/package.json" - - uses: actions/setup-node@v6 - with: - node-version: "24.x" - cache: "pnpm" - cache-dependency-path: "frontend/pnpm-lock.yaml" - - name: Install Task - uses: go-task/setup-task@v1 - - run: task build - - release: - name: Release - needs: ["lint-frontend", "lint-backend", "test", "build"] - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - uses: actions/setup-go@v6 - with: - go-version: '1.25' - - uses: pnpm/action-setup@v4 - with: - package_json_file: "frontend/package.json" - - uses: actions/setup-node@v6 - with: - node-version: "24.x" - cache: "pnpm" - cache-dependency-path: "frontend/pnpm-lock.yaml" - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Install Task - uses: go-task/setup-task@v1 - - run: task build:frontend - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 - with: - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GH_PAT }} - - - diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 5b21ccba79..0000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Docs - -on: - pull_request: - paths: - - 'www' - - '*.md' - push: - branches: - - master - -jobs: - build: - name: Build Docs - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Install Task - uses: go-task/setup-task@v1 - - name: Build site - run: task docs - - build-and-release: - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - name: Build and Release Docs - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Install Task - uses: go-task/setup-task@v1 - - name: Build site - run: task docs - - name: Upload static files as artifact - uses: actions/upload-pages-artifact@v4 - with: - path: www/public - - name: Deploy to GitHub Pages - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/lint-pr.yaml b/.github/workflows/lint-pr.yaml deleted file mode 100644 index f00f44150f..0000000000 --- a/.github/workflows/lint-pr.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: "Lint PR" - -on: - pull_request_target: - types: - - opened - - reopened - - edited - - synchronize - -permissions: - pull-requests: write - -jobs: - main: - name: Validate Title - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v6 - id: lint_pr_title - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - uses: marocchino/sticky-pull-request-comment@v2 - # When the previous steps fails, the workflow would stop. By adding this - # condition you can continue the execution with the populated error message. - if: always() && (steps.lint_pr_title.outputs.error_message != null) - with: - header: pr-title-lint-error - message: | - Hey there and thank you for opening this pull request! 👋🏼 - - We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. - - Details: - - ``` - ${{ steps.lint_pr_title.outputs.error_message }} - ``` - - # Delete a previous comment when the issue has been resolved - - if: ${{ steps.lint_pr_title.outputs.error_message == null }} - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - delete: true diff --git a/HOW_TO_BUILD.md b/HOW_TO_BUILD.md new file mode 100644 index 0000000000..a2597102b7 --- /dev/null +++ b/HOW_TO_BUILD.md @@ -0,0 +1,26 @@ +以下说明适用于linux机器 + +## 准备依赖 +- go task: https://taskfile.dev/docs/installation +- nodejs and pnpm: https://nodejs.org/zh-cn/download +- go: https://go.dev/doc/install +- 正确安装官方docker,需要buildx-plugin +- 执行`docker buildx create --use` +- `docker run --rm --privileged multiarch/qemu-user-static --reset -p yes`启用多平台支持 +- 准备正确版本的buckycli程序和身份信息,打包环节需要用到 + +## 修改appdoc文件 +修改`./publish/app.doc.json`文件: +- pkg_name: app包名,同一owner的包名必须不同 +- version:版本号。推荐使用符合semver规则的三位数字版本号 + +## 编译-打包-发布流程 +1. 在根目录下执行python3 build_dapp.py进行全平台编译 + > 可以配置环境变量BUCKYOS_BUILD_ROOT,指定编译结果的输出目录。默认为`/opt/buckyosci` + + > 编译结果输出到`${BUCKYOS_BUILD_ROOT}/app_build/${pkg_name}${version}` +2. 在根目录执行python3 pack_dapp.py进行打包操作 + > 可以通过环境变量BUCKYCLI_PATH指定buckycli程序的位置,默认为`/opt/buckyos/bin/buckycli/buckycli` + > 正确的身份文件必须放置在~/.buckycli目录下 + + > 打包结果输出到`${BUCKYOS_BUILD_ROOT}/app/${pkg_name}${version}`