feat: dual-publish platform binaries for oh-my-openagent
After publishing oh-my-opencode-{platform}, rename package.json and
publish oh-my-openagent-{platform} from the same build artifact.
Download/extract steps now run if either package needs publishing.
This commit is contained in:
@@ -193,10 +193,9 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Job 2: Publish all platforms using OIDC/Provenance
|
# Job 2: Publish all platforms (oh-my-opencode + oh-my-openagent)
|
||||||
# - Runs on ubuntu-latest for ALL platforms (just downloading artifacts)
|
# - Runs on ubuntu-latest for ALL platforms (just downloading artifacts)
|
||||||
# - Uses npm Trusted Publishing (OIDC) - no NODE_AUTH_TOKEN needed
|
# - Uses NODE_AUTH_TOKEN for auth + OIDC for provenance attestation
|
||||||
# - Fresh OIDC token at publish time avoids timeout issues
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
publish:
|
publish:
|
||||||
needs: build
|
needs: build
|
||||||
@@ -208,7 +207,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
platform: [darwin-arm64, darwin-x64, darwin-x64-baseline, linux-x64, linux-x64-baseline, linux-arm64, linux-x64-musl, linux-x64-musl-baseline, linux-arm64-musl, windows-x64, windows-x64-baseline]
|
platform: [darwin-arm64, darwin-x64, darwin-x64-baseline, linux-x64, linux-x64-baseline, linux-arm64, linux-x64-musl, linux-x64-musl-baseline, linux-arm64-musl, windows-x64, windows-x64-baseline]
|
||||||
steps:
|
steps:
|
||||||
- name: Check if already published
|
- name: Check if oh-my-opencode already published
|
||||||
id: check
|
id: check
|
||||||
run: |
|
run: |
|
||||||
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
||||||
@@ -222,9 +221,23 @@ jobs:
|
|||||||
echo "→ ${PKG_NAME}@${VERSION} will be published"
|
echo "→ ${PKG_NAME}@${VERSION} will be published"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Check if oh-my-openagent already published
|
||||||
|
id: check-openagent
|
||||||
|
run: |
|
||||||
|
PKG_NAME="oh-my-openagent-${{ matrix.platform }}"
|
||||||
|
VERSION="${{ inputs.version }}"
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/${PKG_NAME}/${VERSION}")
|
||||||
|
if [ "$STATUS" = "200" ]; then
|
||||||
|
echo "skip=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "✓ ${PKG_NAME}@${VERSION} already published, skipping"
|
||||||
|
else
|
||||||
|
echo "skip=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "→ ${PKG_NAME}@${VERSION} will be published"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
id: download
|
id: download
|
||||||
if: steps.check.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true' || steps.check-openagent.outputs.skip != 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -232,7 +245,7 @@ jobs:
|
|||||||
path: .
|
path: .
|
||||||
|
|
||||||
- name: Extract artifact
|
- name: Extract artifact
|
||||||
if: steps.check.outputs.skip != 'true' && steps.download.outcome == 'success'
|
if: (steps.check.outputs.skip != 'true' || steps.check-openagent.outputs.skip != 'true') && steps.download.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
PLATFORM="${{ matrix.platform }}"
|
PLATFORM="${{ matrix.platform }}"
|
||||||
mkdir -p packages/${PLATFORM}
|
mkdir -p packages/${PLATFORM}
|
||||||
@@ -248,7 +261,7 @@ jobs:
|
|||||||
ls -la packages/${PLATFORM}/bin/
|
ls -la packages/${PLATFORM}/bin/
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
if: steps.check.outputs.skip != 'true' && steps.download.outcome == 'success'
|
if: (steps.check.outputs.skip != 'true' || steps.check-openagent.outputs.skip != 'true') && steps.download.outcome == 'success'
|
||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
@@ -268,3 +281,25 @@ jobs:
|
|||||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||||
NPM_CONFIG_PROVENANCE: true
|
NPM_CONFIG_PROVENANCE: true
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
|
- name: Publish oh-my-openagent-${{ matrix.platform }}
|
||||||
|
if: steps.check-openagent.outputs.skip != 'true' && steps.download.outcome == 'success'
|
||||||
|
run: |
|
||||||
|
cd packages/${{ matrix.platform }}
|
||||||
|
|
||||||
|
# Rename package for oh-my-openagent
|
||||||
|
jq --arg name "oh-my-openagent-${{ matrix.platform }}" \
|
||||||
|
--arg desc "Platform-specific binary for oh-my-openagent (${{ matrix.platform }})" \
|
||||||
|
'.name = $name | .description = $desc | .bin = {"oh-my-openagent": (.bin | to_entries | .[0].value)}' \
|
||||||
|
package.json > tmp.json && mv tmp.json package.json
|
||||||
|
|
||||||
|
TAG_ARG=""
|
||||||
|
if [ -n "${{ inputs.dist_tag }}" ]; then
|
||||||
|
TAG_ARG="--tag ${{ inputs.dist_tag }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
npm publish --access public --provenance $TAG_ARG
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||||
|
NPM_CONFIG_PROVENANCE: true
|
||||||
|
timeout-minutes: 15
|
||||||
|
|||||||
Reference in New Issue
Block a user