chore(release): 0.1.3 #8
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| deploy-convex: | |
| name: Deploy Convex Backend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install | |
| run: bun install | |
| - name: Deploy to Convex | |
| run: bunx convex deploy | |
| working-directory: packages/backend | |
| env: | |
| CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }} | |
| build: | |
| name: Build ${{ matrix.target }} | |
| needs: deploy-convex | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - target: darwin-arm64 | |
| os: macos-latest | |
| bun_target: bun-darwin-arm64 | |
| - target: darwin-x64 | |
| os: macos-latest | |
| bun_target: bun-darwin-x64 | |
| - target: linux-arm64 | |
| os: ubuntu-latest | |
| bun_target: bun-linux-arm64 | |
| - target: linux-x64 | |
| os: ubuntu-latest | |
| bun_target: bun-linux-x64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install | |
| run: bun install | |
| - name: Generate Convex types | |
| run: bunx convex codegen | |
| working-directory: packages/backend | |
| env: | |
| CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }} | |
| - name: Build CLI and dependencies | |
| run: bunx turbo build --filter=offworld... | |
| env: | |
| CONVEX_URL: ${{ secrets.CONVEX_URL }} | |
| WORKOS_CLIENT_ID: ${{ secrets.WORKOS_CLIENT_ID }} | |
| - name: Test | |
| run: bunx turbo test --filter=offworld... | |
| env: | |
| CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }} | |
| CONVEX_URL: ${{ secrets.CONVEX_URL }} | |
| - name: Compile CLI binary | |
| run: | | |
| bun build ./dist/cli.mjs --compile --target=${{ matrix.bun_target }} --outfile=ow | |
| working-directory: apps/cli | |
| - name: Create archive | |
| run: | | |
| tar -czvf ow-${{ matrix.target }}.tar.gz ow | |
| working-directory: apps/cli | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ow-${{ matrix.target }} | |
| path: apps/cli/ow-${{ matrix.target }}.tar.gz | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Move artifacts | |
| run: | | |
| mkdir -p release | |
| find artifacts -name "*.tar.gz" -exec mv {} release/ \; | |
| - name: Generate checksums | |
| run: | | |
| cd release | |
| sha256sum *.tar.gz > checksums.txt | |
| - name: Get version | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| bunx changelogithub --output RELEASE_NOTES.md --no-group | |
| echo "Generated changelog:" | |
| cat RELEASE_NOTES.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Release ${{ steps.version.outputs.version }} | |
| body_path: RELEASE_NOTES.md | |
| files: | | |
| release/*.tar.gz | |
| release/checksums.txt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Release Summary | |
| run: | | |
| echo "## Release ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Assets" >> $GITHUB_STEP_SUMMARY | |
| echo "| Platform | File |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| macOS (Apple Silicon) | \`ow-darwin-arm64.tar.gz\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "| macOS (Intel) | \`ow-darwin-x64.tar.gz\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Linux (ARM64) | \`ow-linux-arm64.tar.gz\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Linux (x64) | \`ow-linux-x64.tar.gz\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Links" >> $GITHUB_STEP_SUMMARY | |
| echo "- [GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }})" >> $GITHUB_STEP_SUMMARY | |
| echo "- [npm package](https://www.npmjs.com/package/offworld)" >> $GITHUB_STEP_SUMMARY | |
| publish-npm: | |
| name: Publish to npm | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install | |
| run: bun install | |
| - name: Generate Convex types | |
| run: bunx convex codegen | |
| working-directory: packages/backend | |
| env: | |
| CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }} | |
| - name: Build CLI and dependencies | |
| run: bunx turbo build --filter=offworld... | |
| env: | |
| CONVEX_URL: ${{ secrets.CONVEX_URL }} | |
| WORKOS_CLIENT_ID: ${{ secrets.WORKOS_CLIENT_ID }} | |
| - name: Get version and catalog | |
| id: versions | |
| run: | | |
| VERSION=$(jq -r .version apps/cli/package.json) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| # Extract catalog versions for resolving catalog: references | |
| echo "convex=$(jq -r '.workspaces.catalog.convex' package.json)" >> $GITHUB_OUTPUT | |
| echo "zod=$(jq -r '.workspaces.catalog.zod' package.json)" >> $GITHUB_OUTPUT | |
| - name: Rewrite dependencies for npm | |
| run: | | |
| VERSION="${{ steps.versions.outputs.version }}" | |
| CONVEX="${{ steps.versions.outputs.convex }}" | |
| ZOD="${{ steps.versions.outputs.zod }}" | |
| # @offworld/types - resolve catalog: | |
| jq --arg zod "$ZOD" \ | |
| '.dependencies.zod = $zod' \ | |
| packages/types/package.json > tmp.json && mv tmp.json packages/types/package.json | |
| # @offworld/backend-api - resolve catalog: | |
| jq --arg convex "$CONVEX" \ | |
| '.dependencies.convex = $convex' \ | |
| packages/backend-api/package.json > tmp.json && mv tmp.json packages/backend-api/package.json | |
| # @offworld/sdk - resolve workspace: and catalog: | |
| jq --arg v "^$VERSION" --arg convex "$CONVEX" --arg zod "$ZOD" \ | |
| '.dependencies["@offworld/backend-api"] = $v | .dependencies["@offworld/types"] = $v | .dependencies.convex = $convex | .dependencies.zod = $zod' \ | |
| packages/sdk/package.json > tmp.json && mv tmp.json packages/sdk/package.json | |
| # offworld (CLI) - resolve workspace: and catalog: | |
| jq --arg v "^$VERSION" --arg convex "$CONVEX" --arg zod "$ZOD" \ | |
| '.dependencies["@offworld/sdk"] = $v | .dependencies["@offworld/types"] = $v | .dependencies.convex = $convex | .dependencies.zod = $zod' \ | |
| apps/cli/package.json > tmp.json && mv tmp.json apps/cli/package.json | |
| echo "Resolved dependencies:" | |
| echo "types:" && jq .dependencies packages/types/package.json | |
| echo "backend-api:" && jq .dependencies packages/backend-api/package.json | |
| echo "sdk:" && jq .dependencies packages/sdk/package.json | |
| echo "cli:" && jq .dependencies apps/cli/package.json | |
| - name: Publish @offworld/types | |
| id: publish_types | |
| run: | | |
| VERSION="${{ steps.versions.outputs.version }}" | |
| if npm view @offworld/types@$VERSION > /dev/null 2>&1; then | |
| echo "skipped=true" >> $GITHUB_OUTPUT | |
| echo "@offworld/types@$VERSION already published, skipping" | |
| else | |
| cd packages/types && npm publish --access public | |
| echo "skipped=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish @offworld/backend-api | |
| id: publish_backend_api | |
| run: | | |
| VERSION="${{ steps.versions.outputs.version }}" | |
| if npm view @offworld/backend-api@$VERSION > /dev/null 2>&1; then | |
| echo "skipped=true" >> $GITHUB_OUTPUT | |
| echo "@offworld/backend-api@$VERSION already published, skipping" | |
| else | |
| cd packages/backend-api && npm publish --access public | |
| echo "skipped=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish @offworld/sdk | |
| id: publish_sdk | |
| run: | | |
| VERSION="${{ steps.versions.outputs.version }}" | |
| if npm view @offworld/sdk@$VERSION > /dev/null 2>&1; then | |
| echo "skipped=true" >> $GITHUB_OUTPUT | |
| echo "@offworld/sdk@$VERSION already published, skipping" | |
| else | |
| cd packages/sdk && npm publish --access public | |
| echo "skipped=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish offworld (CLI) | |
| id: publish_cli | |
| run: | | |
| VERSION="${{ steps.versions.outputs.version }}" | |
| if npm view offworld@$VERSION > /dev/null 2>&1; then | |
| echo "skipped=true" >> $GITHUB_OUTPUT | |
| echo "offworld@$VERSION already published, skipping" | |
| else | |
| cd apps/cli && npm publish --access public | |
| echo "skipped=false" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish Summary | |
| run: | | |
| VERSION="${{ steps.versions.outputs.version }}" | |
| echo "## npm Publish Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Package | Version | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|---------|---------|--------|" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.publish_types.outputs.skipped }}" = "true" ]; then | |
| echo "| @offworld/types | $VERSION | Skipped (exists) |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| @offworld/types | $VERSION | Published |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [ "${{ steps.publish_backend_api.outputs.skipped }}" = "true" ]; then | |
| echo "| @offworld/backend-api | $VERSION | Skipped (exists) |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| @offworld/backend-api | $VERSION | Published |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [ "${{ steps.publish_sdk.outputs.skipped }}" = "true" ]; then | |
| echo "| @offworld/sdk | $VERSION | Skipped (exists) |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| @offworld/sdk | $VERSION | Published |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [ "${{ steps.publish_cli.outputs.skipped }}" = "true" ]; then | |
| echo "| offworld | $VERSION | Skipped (exists) |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| offworld | $VERSION | Published |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| update-homebrew: | |
| name: Update Homebrew Tap | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get version | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Checkout tap | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: oscabriel/homebrew-tap | |
| token: ${{ secrets.TAP_TOKEN }} | |
| path: tap | |
| - name: Download checksums | |
| run: | | |
| URL="https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.version }}/checksums.txt" | |
| echo "Downloading checksums from: $URL" | |
| curl -fSL "$URL" -o checksums.txt | |
| echo "Downloaded checksums.txt:" | |
| cat checksums.txt | |
| - name: Update formula | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| DARWIN_ARM64_SHA=$(grep "darwin-arm64" checksums.txt | awk '{print $1}') | |
| DARWIN_X64_SHA=$(grep "darwin-x64" checksums.txt | awk '{print $1}') | |
| LINUX_ARM64_SHA=$(grep "linux-arm64" checksums.txt | awk '{print $1}') | |
| LINUX_X64_SHA=$(grep "linux-x64" checksums.txt | awk '{print $1}') | |
| # Verify all checksums were extracted | |
| echo "Extracted checksums:" | |
| echo " darwin-arm64: $DARWIN_ARM64_SHA" | |
| echo " darwin-x64: $DARWIN_X64_SHA" | |
| echo " linux-arm64: $LINUX_ARM64_SHA" | |
| echo " linux-x64: $LINUX_X64_SHA" | |
| if [ -z "$DARWIN_ARM64_SHA" ] || [ -z "$DARWIN_X64_SHA" ] || [ -z "$LINUX_ARM64_SHA" ] || [ -z "$LINUX_X64_SHA" ]; then | |
| echo "Error: One or more checksums are empty" | |
| exit 1 | |
| fi | |
| cat > tap/Formula/offworld.rb << EOF | |
| class Offworld < Formula | |
| desc "Offworld CLI - Generate references for your dependencies" | |
| homepage "https://offworld.sh" | |
| version "$VERSION" | |
| license "MIT" | |
| on_macos do | |
| if Hardware::CPU.arm? | |
| url "https://github.com/${{ github.repository }}/releases/download/v$VERSION/ow-darwin-arm64.tar.gz" | |
| sha256 "$DARWIN_ARM64_SHA" | |
| else | |
| url "https://github.com/${{ github.repository }}/releases/download/v$VERSION/ow-darwin-x64.tar.gz" | |
| sha256 "$DARWIN_X64_SHA" | |
| end | |
| end | |
| on_linux do | |
| if Hardware::CPU.arm? | |
| url "https://github.com/${{ github.repository }}/releases/download/v$VERSION/ow-linux-arm64.tar.gz" | |
| sha256 "$LINUX_ARM64_SHA" | |
| else | |
| url "https://github.com/${{ github.repository }}/releases/download/v$VERSION/ow-linux-x64.tar.gz" | |
| sha256 "$LINUX_X64_SHA" | |
| end | |
| end | |
| def install | |
| bin.install "ow" | |
| end | |
| test do | |
| assert_match "ow", shell_output("#{bin}/ow --version") | |
| end | |
| end | |
| EOF | |
| # Remove leading whitespace from heredoc | |
| sed -i 's/^ //' tap/Formula/offworld.rb | |
| # Remove old formula if present | |
| rm -f tap/Formula/ow.rb | |
| echo "Generated formula:" | |
| cat tap/Formula/offworld.rb | |
| - name: Commit and push | |
| run: | | |
| cd tap | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| git add Formula/offworld.rb | |
| git rm -f Formula/ow.rb | |
| git commit -m "Update offworld to v${{ steps.version.outputs.version }}" | |
| git push |