Release #10
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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g. 0.1.0, 0.1.0-rc.1)" | |
| required: true | |
| type: string | |
| npm-tag: | |
| description: "npm dist-tag" | |
| required: true | |
| type: choice | |
| options: | |
| - latest | |
| - rc | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| name: "Publish" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout tag | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: v${{ inputs.version }} | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build | |
| run: pnpm build --filter='!@rivet-dev/agent-os-playground' --filter='!./examples/*' | |
| - name: Publish to npm | |
| run: | | |
| FAILURES="" | |
| # Publish workspace packages (skip root, skip registry/software/) | |
| for dir in $(pnpm -r ls --json --depth -1 | jq -r '.[] | select(.private != true) | .path'); do | |
| # Skip the root package | |
| if [ "$dir" = "$(pwd)" ]; then | |
| continue | |
| fi | |
| # Skip registry/software/ packages (published separately via make publish) | |
| if [[ "$dir" == *"/registry/software/"* ]]; then | |
| echo "⏭ Skipping software package: $(jq -r .name "$dir/package.json")" | |
| continue | |
| fi | |
| NAME=$(jq -r .name "$dir/package.json") | |
| VERSION="${{ inputs.version }}" | |
| if npm view "${NAME}@${VERSION}" version >/dev/null 2>&1; then | |
| echo "⏭ ${NAME}@${VERSION} already published, skipping." | |
| continue | |
| fi | |
| echo "Publishing ${NAME}@${VERSION}..." | |
| if ! (cd "$dir" && pnpm publish --access public --tag ${{ inputs.npm-tag }} --no-git-checks); then | |
| FAILURES="${FAILURES} ${NAME}" | |
| fi | |
| done | |
| if [ -n "$FAILURES" ]; then | |
| echo "::error::Failed to publish:${FAILURES}" | |
| exit 1 | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub release | |
| run: | | |
| if gh release view "v${{ inputs.version }}" >/dev/null 2>&1; then | |
| echo "GitHub release v${{ inputs.version }} already exists, skipping." | |
| else | |
| PRERELEASE="" | |
| if [ "${{ inputs.npm-tag }}" = "rc" ]; then | |
| PRERELEASE="--prerelease" | |
| fi | |
| gh release create "v${{ inputs.version }}" \ | |
| --title "v${{ inputs.version }}" \ | |
| --generate-notes \ | |
| $PRERELEASE | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} |