mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 04:30:59 +00:00
155 lines
5.0 KiB
YAML
155 lines
5.0 KiB
YAML
name: Publish and Release
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
release-please:
|
|
runs-on: ubuntu-latest
|
|
environment: release # Optional: for enhanced security
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
steps:
|
|
# Generating a GitHub token, so that PRs and tags created by
|
|
# the release-please-action can trigger actions workflows.
|
|
- name: Generate GitHub token
|
|
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
|
|
id: generate-token
|
|
with:
|
|
# GitHub App ID secret name
|
|
app-id: ${{ secrets.RELEASE_PLZ_APP_ID }}
|
|
# GitHub App private key secret name
|
|
private-key: ${{ secrets.RELEASE_PLZ_APP_PRIVATE_KEY }}
|
|
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38
|
|
id: release
|
|
with:
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
release-type: node
|
|
config-file: release-please-config.json
|
|
manifest-file: .release-please-manifest.json
|
|
outputs:
|
|
release_created: ${{ steps.release.outputs.release_created }}
|
|
tag_name: ${{ steps.release.outputs.tag_name }}
|
|
|
|
build-binaries:
|
|
name: Build (${{ matrix.target }})
|
|
runs-on: ubuntu-latest
|
|
needs: [release-please]
|
|
if: ${{ needs.release-please.outputs.release_created }}
|
|
permissions:
|
|
contents: read
|
|
timeout-minutes: 15
|
|
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
include:
|
|
- target: bun-linux-x64
|
|
artifact: claude-agent-acp
|
|
archive: claude-agent-acp-linux-x64.tar.gz
|
|
- target: bun-linux-arm64
|
|
artifact: claude-agent-acp
|
|
archive: claude-agent-acp-linux-arm64.tar.gz
|
|
- target: bun-linux-x64-musl
|
|
artifact: claude-agent-acp
|
|
archive: claude-agent-acp-linux-x64-musl.tar.gz
|
|
- target: bun-linux-arm64-musl
|
|
artifact: claude-agent-acp
|
|
archive: claude-agent-acp-linux-arm64-musl.tar.gz
|
|
- target: bun-darwin-x64
|
|
artifact: claude-agent-acp
|
|
archive: claude-agent-acp-darwin-x64.zip
|
|
- target: bun-darwin-arm64
|
|
artifact: claude-agent-acp
|
|
archive: claude-agent-acp-darwin-arm64.zip
|
|
- target: bun-windows-x64
|
|
artifact: claude-agent-acp.exe
|
|
archive: claude-agent-acp-windows-x64.zip
|
|
- target: bun-windows-arm64
|
|
artifact: claude-agent-acp.exe
|
|
archive: claude-agent-acp-windows-arm64.zip
|
|
|
|
steps:
|
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
|
|
|
- uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Build binary
|
|
run: |
|
|
bun build src/index.ts \
|
|
--compile \
|
|
--target ${{ matrix.target }} \
|
|
--define 'process.env.CLAUDE_AGENT_ACP_IS_SINGLE_FILE_BUN="true"' \
|
|
--outfile ${{ matrix.artifact }}
|
|
|
|
- name: Compress binary
|
|
run: |
|
|
if [[ "${{ matrix.archive }}" == *.zip ]]; then
|
|
zip ${{ matrix.archive }} ${{ matrix.artifact }}
|
|
else
|
|
tar czf ${{ matrix.archive }} ${{ matrix.artifact }}
|
|
fi
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
|
with:
|
|
name: ${{ matrix.archive }}
|
|
path: ${{ matrix.archive }}
|
|
|
|
publish-npm:
|
|
name: Publish to npm
|
|
runs-on: ubuntu-latest
|
|
needs: [build-binaries, release-please]
|
|
if: ${{ needs.release-please.outputs.release_created }}
|
|
environment: release # Optional: for enhanced security
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
|
# Setup .npmrc file to publish to npm
|
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
|
with:
|
|
node-version: "lts/*"
|
|
registry-url: "https://registry.npmjs.org"
|
|
- name: Update npm
|
|
run: npm install -g npm@latest
|
|
- run: npm ci
|
|
- run: npm run build
|
|
- run: npm publish
|
|
|
|
release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
needs: [build-binaries, publish-npm, release-please]
|
|
if: ${{ needs.release-please.outputs.release_created }}
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
|
|
with:
|
|
path: artifacts
|
|
merge-multiple: true
|
|
|
|
- name: Upload artifacts
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release upload \
|
|
"${{ needs.release-please.outputs.tag_name }}" \
|
|
artifacts/* \
|
|
--clobber
|