release-please-published #22
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 Released Packages | |
| on: | |
| repository_dispatch: | |
| types: | |
| - release-please-published | |
| workflow_dispatch: | |
| jobs: | |
| resolve-release-set: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| publish_client: ${{ steps.resolve.outputs.publish_client }} | |
| publish_tui: ${{ steps.resolve.outputs.publish_tui }} | |
| publish_server: ${{ steps.resolve.outputs.publish_server }} | |
| released_paths_json: ${{ steps.resolve.outputs.released_paths_json }} | |
| server_tag: ${{ steps.server-tag.outputs.tag }} | |
| steps: | |
| - name: Resolve released package paths | |
| id: resolve | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const payloadPaths = context.payload.client_payload?.paths_released || []; | |
| const releasedPaths = Array.isArray(payloadPaths) ? payloadPaths : []; | |
| const isTuiPath = (path) => | |
| path === 'apps/tui' || path.startsWith('apps/tui/packages/'); | |
| const publishClient = releasedPaths.includes('packages/client-js'); | |
| const publishTui = releasedPaths.some(isTuiPath); | |
| const publishServer = releasedPaths.includes('crates/bizi-server'); | |
| core.setOutput('publish_client', String(publishClient)); | |
| core.setOutput('publish_tui', String(publishTui)); | |
| core.setOutput('publish_server', String(publishServer)); | |
| core.setOutput('released_paths_json', JSON.stringify(releasedPaths)); | |
| - uses: actions/checkout@v4 | |
| if: steps.resolve.outputs.publish_server == 'true' | |
| - name: Get latest server release tag | |
| id: server-tag | |
| if: steps.resolve.outputs.publish_server == 'true' | |
| run: | | |
| git fetch --tags --force | |
| tag=$(git tag -l 'server-v*' --sort=-v:refname | head -1) | |
| echo "tag=$tag" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-server: | |
| needs: [resolve-release-set] | |
| if: ${{ needs.resolve-release-set.outputs.publish_server == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for OIDC token exchange | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: rust-lang/crates-io-auth-action@v1 | |
| id: auth | |
| - name: Publish server crate | |
| run: cargo publish -p bizi-server | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} | |
| build-server-assets-macos: | |
| needs: [resolve-release-set] | |
| if: ${{ needs.resolve-release-set.outputs.publish_server == 'true' }} | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.resolve-release-set.outputs.server_tag }} | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-darwin, x86_64-apple-darwin | |
| - name: Build (aarch64-apple-darwin, x86_64-apple-darwin) | |
| run: | | |
| cargo build -p bizi-server --release --target aarch64-apple-darwin & | |
| cargo build -p bizi-server --release --target x86_64-apple-darwin & | |
| wait | |
| - name: Rename and upload aarch64 | |
| run: cp target/aarch64-apple-darwin/release/bizi-server bizi-server-aarch64-apple-darwin | |
| - name: Upload aarch64 artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bizi-server-aarch64-apple-darwin | |
| path: bizi-server-aarch64-apple-darwin | |
| - name: Rename and upload x86_64 | |
| run: cp target/x86_64-apple-darwin/release/bizi-server bizi-server-x86_64-apple-darwin | |
| - name: Upload x86_64 artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bizi-server-x86_64-apple-darwin | |
| path: bizi-server-x86_64-apple-darwin | |
| build-server-assets-windows: | |
| needs: [resolve-release-set] | |
| if: ${{ needs.resolve-release-set.outputs.publish_server == 'true' }} | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.resolve-release-set.outputs.server_tag }} | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-pc-windows-msvc, aarch64-pc-windows-msvc | |
| - name: Build (x86_64-pc-windows-msvc, aarch64-pc-windows-msvc) | |
| shell: bash | |
| run: | | |
| cargo build -p bizi-server --release --target x86_64-pc-windows-msvc & | |
| cargo build -p bizi-server --release --target aarch64-pc-windows-msvc & | |
| wait | |
| - name: Rename and upload x86_64 | |
| run: Copy-Item target/x86_64-pc-windows-msvc/release/bizi-server.exe bizi-server-x86_64-pc-windows-msvc.exe | |
| shell: pwsh | |
| - name: Upload x86_64 artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bizi-server-x86_64-pc-windows-msvc.exe | |
| path: bizi-server-x86_64-pc-windows-msvc.exe | |
| - name: Rename and upload aarch64 | |
| run: Copy-Item target/aarch64-pc-windows-msvc/release/bizi-server.exe bizi-server-aarch64-pc-windows-msvc.exe | |
| shell: pwsh | |
| - name: Upload aarch64 artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bizi-server-aarch64-pc-windows-msvc.exe | |
| path: bizi-server-aarch64-pc-windows-msvc.exe | |
| upload-server-release-assets: | |
| needs: [resolve-release-set, build-server-assets-macos, build-server-assets-windows] | |
| if: ${{ needs.resolve-release-set.outputs.publish_server == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: false | |
| - name: Collect release files | |
| run: | | |
| mkdir -p release | |
| for name in bizi-server-aarch64-apple-darwin bizi-server-x86_64-apple-darwin bizi-server-x86_64-pc-windows-msvc.exe bizi-server-aarch64-pc-windows-msvc.exe; do | |
| if [ -f "$name" ]; then | |
| cp "$name" release/ | |
| elif [ -f "$name/$name" ]; then | |
| cp "$name/$name" release/ | |
| else | |
| echo "::warning::Artifact not found: $name" | |
| fi | |
| done | |
| echo "Release files:" | |
| ls -la release/ | |
| - name: Upload server artifacts to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.resolve-release-set.outputs.server_tag }} | |
| files: release/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-client: | |
| needs: [resolve-release-set] | |
| if: ${{ needs.resolve-release-set.outputs.publish_client == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node for OIDC token exchange | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build client package | |
| run: pnpm --filter @getbizi/client build | |
| - name: Publish client | |
| working-directory: packages/client-js | |
| run: pnpm publish --access public --provenance | |
| publish-tui: | |
| needs: [resolve-release-set] | |
| if: ${{ needs.resolve-release-set.outputs.publish_tui == 'true' }} | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Bun (for TUI compilation) | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.2.13 | |
| - name: Setup Node for OIDC token exchange | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build client package | |
| run: pnpm --filter @getbizi/client build | |
| - name: Build TUI artifacts for npm packages | |
| run: | | |
| pnpm --filter bizi compile:all | |
| pnpm --filter bizi build:bundle | |
| - name: Publish TUI platform packages first | |
| run: | | |
| pnpm publish ./apps/tui/packages/bizi-darwin-arm64 --access public --provenance | |
| pnpm publish ./apps/tui/packages/bizi-darwin-x64 --access public --provenance | |
| pnpm publish ./apps/tui/packages/bizi-win32-x64 --access public --provenance | |
| pnpm publish ./apps/tui/packages/bizi-win32-arm64 --access public --provenance | |
| - name: Publish main TUI package | |
| run: pnpm publish ./apps/tui --access public --provenance |