fork-release #36
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
| # Fork release — build CLI binaries for all platforms | |
| # Stripped-down version of publish.yml for LeXwDeX/opencode fork. | |
| # Removes: repo guard, Blacksmith runners, code signing, npm publish, Tauri desktop. | |
| # | |
| # Usage: | |
| # 1. Go to Actions → "fork-release" → Run workflow | |
| # 2. Pick the branch and optionally set a version | |
| # 3. Download artifacts from the completed run | |
| # 4. Or: set create_release=true to auto-create a GitHub Release with assets | |
| name: fork-release | |
| on: | |
| # Manual trigger — the primary way to build releases | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version (e.g. 1.14.30-fork.2). Leave blank for auto." | |
| required: false | |
| type: string | |
| create_release: | |
| description: "Create a GitHub Release with the built binaries" | |
| required: false | |
| type: boolean | |
| default: false | |
| # Also run on push to dev so the workflow registers in Actions UI on first push | |
| push: | |
| branches: [dev] | |
| paths: | |
| - ".github/workflows/fork-release.yml" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-cli: | |
| # Skip the actual build when triggered by push (registration-only) | |
| if: github.event_name == 'workflow_dispatch' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| name: linux | |
| - os: macos-latest | |
| name: macos | |
| - os: windows-latest | |
| name: windows | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/setup-bun | |
| - name: Build CLI | |
| run: ./packages/opencode/script/build.ts --single --skip-install | |
| env: | |
| OPENCODE_CHANNEL: latest | |
| OPENCODE_VERSION: ${{ inputs.version || '' }} | |
| # Bundle ripgrep into each dist/opencode-*/bin so air-gapped users do not | |
| # hit the runtime download in packages/opencode/src/file/ripgrep.ts. | |
| - name: Prefetch ripgrep | |
| run: bun run ./packages/opencode/script/prefetch-ripgrep.ts | |
| - name: Package artifacts | |
| working-directory: packages/opencode/dist | |
| run: | | |
| for dir in opencode-*/; do | |
| base="${dir%/}" | |
| if [[ "$base" == *linux* ]]; then | |
| tar -czf "${base}.tar.gz" -C "${base}/bin" . | |
| else | |
| cd "${base}/bin" | |
| if command -v zip &>/dev/null; then | |
| zip -r "../../${base}.zip" . | |
| else | |
| pwsh -Command "Compress-Archive -Path '*' -DestinationPath '../../${base}.zip'" 2>/dev/null || 7z a "../../${base}.zip" . || true | |
| fi | |
| cd ../.. | |
| fi | |
| done | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: opencode-${{ matrix.name }} | |
| path: | | |
| packages/opencode/dist/*.tar.gz | |
| packages/opencode/dist/*.zip | |
| release: | |
| needs: build-cli | |
| if: inputs.create_release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| merge-multiple: true | |
| - name: Determine version tag | |
| id: tag | |
| run: | | |
| VER="${{ inputs.version }}" | |
| if [ -z "$VER" ]; then | |
| VER="0.0.0-$(date +%Y%m%d%H%M)" | |
| fi | |
| echo "version=$VER" >> "$GITHUB_OUTPUT" | |
| echo "tag=v$VER" >> "$GITHUB_OUTPUT" | |
| - name: Generate SHA256SUMS | |
| working-directory: release-assets | |
| run: | | |
| shasum -a 256 * > SHA256SUMS || sha256sum * > SHA256SUMS | |
| echo "--- SHA256SUMS ---" | |
| cat SHA256SUMS | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "${{ steps.tag.outputs.tag }}" \ | |
| --title "opencode ${{ steps.tag.outputs.version }}" \ | |
| --notes "Fork release from branch ${{ github.ref_name }}" \ | |
| --target "${{ github.sha }}" \ | |
| release-assets/* | |
| # No-op job for push-triggered runs — just registers the workflow in Actions UI | |
| register: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "Workflow registered in Actions UI" |