feat(server): Service instances support manual online/offline access #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | |
| on: | |
| push: | |
| tags: [ "*" ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest, ubuntu-24.04-arm ] | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| arch_name: x86_64 | |
| - os: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-musl | |
| arch_name: arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # 安装 Node | |
| - name: Install Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| # 安装 musl 工具 | |
| - name: Install musl tools | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools | |
| # 添加 musl 目标 | |
| - name: Add musl target | |
| run: rustup target add ${{ matrix.target }} | |
| # 克隆前端代码 | |
| - name: Checkout frontend code | |
| run: | | |
| git clone https://github.com/xgpxg/conreg-ui.git | |
| # 设置前端环境变量并构建 | |
| - name: Build frontend | |
| run: | | |
| cd conreg-ui | |
| sed -i "s/^VITE_VERSION=.*/VITE_VERSION=${{ github.ref_name }}/" .env.production | |
| npm install | |
| npm run build | |
| # 创建 web 目录并复制前端构建文件 | |
| - name: Copy frontend build to web directory | |
| run: | | |
| mkdir -p web | |
| cp -r conreg-ui/dist/* web/ | |
| # 构建后端服务 | |
| - name: Build | |
| run: cargo build -r --bin conreg-server --target ${{ matrix.target }} | |
| # 压缩二进制文件 | |
| - name: Compress binary | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar -czf conreg-server-${{ matrix.arch_name }}.tar.gz conreg-server | |
| # 生成变更日志 | |
| - name: Generate changelog | |
| id: changelog | |
| uses: metcalfc/changelog-generator@v4 | |
| with: | |
| myToken: ${{ secrets.GITHUB_TOKEN }} | |
| # 创建 Release | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| files: target/${{ matrix.target }}/release/conreg-server-${{ matrix.arch_name }}.tar.gz | |
| body: ${{ steps.changelog.outputs.changelog }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |