|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: "Version to release (e.g., 1.0.0)" |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup Bun |
| 24 | + uses: oven-sh/setup-bun@v2 |
| 25 | + with: |
| 26 | + bun-version: latest |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: bun install |
| 30 | + |
| 31 | + - name: Determine version |
| 32 | + id: version |
| 33 | + run: | |
| 34 | + if [ -n "${{ inputs.version }}" ]; then |
| 35 | + VERSION="${{ inputs.version }}" |
| 36 | + else |
| 37 | + VERSION="${GITHUB_REF#refs/tags/v}" |
| 38 | + fi |
| 39 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 40 | + echo "Building version: $VERSION" |
| 41 | +
|
| 42 | + - name: Build CLI |
| 43 | + run: | |
| 44 | + cd packages/opencode |
| 45 | + bun run ./script/build.ts |
| 46 | + env: |
| 47 | + OPENCODE_VERSION: ${{ steps.version.outputs.version }} |
| 48 | + OPENCODE_CHANNEL: latest |
| 49 | + |
| 50 | + - name: Package binaries |
| 51 | + run: | |
| 52 | + cd packages/opencode/dist |
| 53 | +
|
| 54 | + # Create archives for each platform |
| 55 | + for dir in mammouth-*/; do |
| 56 | + name="${dir%/}" |
| 57 | + if [[ "$name" == *"windows"* ]]; then |
| 58 | + zip -r "${name}.zip" "$dir" |
| 59 | + else |
| 60 | + tar -czvf "${name}.tar.gz" "$dir" |
| 61 | + fi |
| 62 | + done |
| 63 | +
|
| 64 | + - name: Create Release |
| 65 | + uses: softprops/action-gh-release@v2 |
| 66 | + with: |
| 67 | + tag_name: v${{ steps.version.outputs.version }} |
| 68 | + name: Mammouth CLI v${{ steps.version.outputs.version }} |
| 69 | + draft: false |
| 70 | + prerelease: false |
| 71 | + files: | |
| 72 | + packages/opencode/dist/*.tar.gz |
| 73 | + packages/opencode/dist/*.zip |
| 74 | + body: | |
| 75 | + ## Mammouth CLI v${{ steps.version.outputs.version }} |
| 76 | +
|
| 77 | + ### Installation |
| 78 | +
|
| 79 | + **curl (recommended)** |
| 80 | + ```bash |
| 81 | + curl -fsSL https://raw.githubusercontent.com/mammouth-ai/opencode/main/install.sh | bash |
| 82 | + ``` |
| 83 | +
|
| 84 | + **Manual download** |
| 85 | + Download the appropriate binary for your platform below. |
| 86 | +
|
| 87 | + | Platform | Architecture | Download | |
| 88 | + |----------|--------------|----------| |
| 89 | + | Linux | x64 | `mammouth-linux-x64.tar.gz` | |
| 90 | + | Linux | arm64 | `mammouth-linux-arm64.tar.gz` | |
| 91 | + | macOS | x64 | `mammouth-darwin-x64.tar.gz` | |
| 92 | + | macOS | arm64 (Apple Silicon) | `mammouth-darwin-arm64.tar.gz` | |
| 93 | + | Windows | x64 | `mammouth-windows-x64.zip` | |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments