mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-27 04:30:59 +00:00
A skipped `release-please` job propagates to downstream jobs during a manual release, even when npm publishing succeeds through an `always()` condition. Explicitly evaluate the npm job result so successful manual publications continue to update the agent registry. Validation: Prettier workflow check.
91 lines
3.1 KiB
YAML
91 lines
3.1 KiB
YAML
name: Publish and Release
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
description: Tag or commit to publish
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
release-please:
|
|
if: ${{ github.event_name == 'push' }}
|
|
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@bcd2ba49218906704ab6c1aa796996da409d3eb1
|
|
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@45996ed1f6d02564a971a2fa1b5860e934307cf7
|
|
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 }}
|
|
|
|
publish-npm:
|
|
name: Publish to npm
|
|
runs-on: ubuntu-latest
|
|
needs: [release-please]
|
|
if: ${{ always() && (github.event_name == 'workflow_dispatch' || needs.release-please.outputs.release_created == 'true') }}
|
|
environment: release # Optional: for enhanced security
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
with:
|
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }}
|
|
# Setup .npmrc file to publish to npm
|
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
with:
|
|
node-version: "lts/*"
|
|
registry-url: "https://registry.npmjs.org"
|
|
- run: npm ci
|
|
- run: npm run build
|
|
- run: npm publish
|
|
|
|
trigger-registry-update:
|
|
needs: publish-npm
|
|
if: ${{ always() && needs.publish-npm.result == 'success' }}
|
|
runs-on: ubuntu-latest
|
|
environment: release
|
|
permissions: {}
|
|
steps:
|
|
- name: Generate token scoped to the registry repo
|
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1
|
|
id: registry-token
|
|
with:
|
|
app-id: ${{ secrets.REGISTRY_UPDATER_APP_ID }}
|
|
private-key: ${{ secrets.REGISTRY_UPDATER_APP_PRIVATE_KEY }}
|
|
owner: ${{ github.repository_owner }}
|
|
repositories: registry
|
|
|
|
- name: Dispatch registry version update
|
|
env:
|
|
GH_TOKEN: ${{ steps.registry-token.outputs.token }}
|
|
run: |
|
|
gh workflow run update-versions.yml \
|
|
--repo ${{ github.repository_owner }}/registry \
|
|
--ref main \
|
|
-f apply=true \
|
|
-f agents=claude-acp
|