fix: use dual-check outputs for opencode/openagent publish conditions
This commit is contained in:
@@ -59,20 +59,39 @@ jobs:
|
|||||||
- name: Check if already published
|
- name: Check if already published
|
||||||
id: check
|
id: check
|
||||||
run: |
|
run: |
|
||||||
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ inputs.version }}"
|
||||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/${PKG_NAME}/${VERSION}")
|
|
||||||
# Convert platform name for output (replace - with _)
|
|
||||||
PLATFORM_KEY="${{ matrix.platform }}"
|
PLATFORM_KEY="${{ matrix.platform }}"
|
||||||
PLATFORM_KEY="${PLATFORM_KEY//-/_}"
|
PLATFORM_KEY="${PLATFORM_KEY//-/_}"
|
||||||
if [ "$STATUS" = "200" ]; then
|
|
||||||
|
# Check oh-my-opencode
|
||||||
|
OC_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/oh-my-opencode-${{ matrix.platform }}/${VERSION}")
|
||||||
|
# Check oh-my-openagent
|
||||||
|
OA_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/oh-my-openagent-${{ matrix.platform }}/${VERSION}")
|
||||||
|
|
||||||
|
echo "oh-my-opencode-${{ matrix.platform }}@${VERSION}: ${OC_STATUS}"
|
||||||
|
echo "oh-my-openagent-${{ matrix.platform }}@${VERSION}: ${OA_STATUS}"
|
||||||
|
|
||||||
|
if [ "$OC_STATUS" = "200" ]; then
|
||||||
|
echo "skip_opencode=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "✓ oh-my-opencode-${{ matrix.platform }}@${VERSION} already published"
|
||||||
|
else
|
||||||
|
echo "skip_opencode=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "→ oh-my-opencode-${{ matrix.platform }}@${VERSION} needs publishing"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$OA_STATUS" = "200" ]; then
|
||||||
|
echo "skip_openagent=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "✓ oh-my-openagent-${{ matrix.platform }}@${VERSION} already published"
|
||||||
|
else
|
||||||
|
echo "skip_openagent=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "→ oh-my-openagent-${{ matrix.platform }}@${VERSION} needs publishing"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Skip build only if BOTH are already published
|
||||||
|
if [ "$OC_STATUS" = "200" ] && [ "$OA_STATUS" = "200" ]; then
|
||||||
echo "skip=true" >> $GITHUB_OUTPUT
|
echo "skip=true" >> $GITHUB_OUTPUT
|
||||||
echo "skip_${PLATFORM_KEY}=true" >> $GITHUB_OUTPUT
|
|
||||||
echo "✓ ${PKG_NAME}@${VERSION} already published"
|
|
||||||
else
|
else
|
||||||
echo "skip=false" >> $GITHUB_OUTPUT
|
echo "skip=false" >> $GITHUB_OUTPUT
|
||||||
echo "skip_${PLATFORM_KEY}=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "→ ${PKG_NAME}@${VERSION} needs publishing"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Update version in package.json
|
- name: Update version in package.json
|
||||||
@@ -225,7 +244,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check if oh-my-opencode already published
|
- name: Check if oh-my-opencode already published
|
||||||
id: check-openagent
|
id: check-opencode
|
||||||
run: |
|
run: |
|
||||||
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ inputs.version }}"
|
||||||
@@ -239,7 +258,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
id: download
|
id: download
|
||||||
if: steps.check.outputs.skip != 'true' || steps.check-openagent.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true' || steps.check-opencode.outputs.skip != 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -247,7 +266,7 @@ jobs:
|
|||||||
path: .
|
path: .
|
||||||
|
|
||||||
- name: Extract artifact
|
- name: Extract artifact
|
||||||
if: (steps.check.outputs.skip != 'true' || steps.check-openagent.outputs.skip != 'true') && steps.download.outcome == 'success'
|
if: (steps.check.outputs.skip != 'true' || steps.check-opencode.outputs.skip != 'true') && steps.download.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
PLATFORM="${{ matrix.platform }}"
|
PLATFORM="${{ matrix.platform }}"
|
||||||
mkdir -p packages/${PLATFORM}
|
mkdir -p packages/${PLATFORM}
|
||||||
@@ -263,7 +282,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.check-openagent.outputs.skip != 'true') && steps.download.outcome == 'success'
|
if: (steps.check.outputs.skip != 'true' || steps.check-opencode.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"
|
||||||
@@ -285,7 +304,7 @@ jobs:
|
|||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
- name: Publish oh-my-opencode-${{ matrix.platform }} (alias)
|
- name: Publish oh-my-opencode-${{ matrix.platform }} (alias)
|
||||||
if: steps.check.outputs.skip != 'true' && steps.download.outcome == 'success'
|
if: steps.check-opencode.outputs.skip != 'true' && steps.download.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
cd packages/${{ matrix.platform }}
|
cd packages/${{ matrix.platform }}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user