chore(release): 0.1.5 #10
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: 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: Publish all packages | |
| run: | | |
| # bun publish handles workspace: and catalog: resolution automatically | |
| # Publish in dependency order, skip if version already exists | |
| for pkg in packages/types packages/backend-api packages/sdk apps/cli; do | |
| cd $pkg | |
| NAME=$(jq -r .name package.json) | |
| VERSION=$(jq -r .version package.json) | |
| if npm view "$NAME@$VERSION" > /dev/null 2>&1; then | |
| echo "::notice::$NAME@$VERSION already published, skipping" | |
| else | |
| echo "Publishing $NAME@$VERSION..." | |
| bun publish --access public | |
| fi | |
| cd - > /dev/null | |
| done | |
| env: | |
| NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish Summary | |
| run: | | |
| VERSION=$(jq -r .version apps/cli/package.json) | |
| echo "## npm Publish Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Package | Version |" >> $GITHUB_STEP_SUMMARY | |
| echo "|---------|---------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| @offworld/types | $VERSION |" >> $GITHUB_STEP_SUMMARY | |
| echo "| @offworld/backend-api | $VERSION |" >> $GITHUB_STEP_SUMMARY | |
| echo "| @offworld/sdk | $VERSION |" >> $GITHUB_STEP_SUMMARY | |
| echo "| offworld | $VERSION |" >> $GITHUB_STEP_SUMMARY | |
| 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 |