fix(publish-platform): use 7z on Windows, simplify skip logic
This commit is contained in:
parent
8e19ffdce4
commit
3d7de0a050
51
.github/workflows/publish-platform.yml
vendored
51
.github/workflows/publish-platform.yml
vendored
@ -44,15 +44,6 @@ jobs:
|
|||||||
max-parallel: 7
|
max-parallel: 7
|
||||||
matrix:
|
matrix:
|
||||||
platform: [darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, windows-x64]
|
platform: [darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, windows-x64]
|
||||||
outputs:
|
|
||||||
# Pass skip status to publish job
|
|
||||||
skip_darwin_arm64: ${{ steps.check.outputs.skip_darwin_arm64 }}
|
|
||||||
skip_darwin_x64: ${{ steps.check.outputs.skip_darwin_x64 }}
|
|
||||||
skip_linux_x64: ${{ steps.check.outputs.skip_linux_x64 }}
|
|
||||||
skip_linux_arm64: ${{ steps.check.outputs.skip_linux_arm64 }}
|
|
||||||
skip_linux_x64_musl: ${{ steps.check.outputs.skip_linux_x64_musl }}
|
|
||||||
skip_linux_arm64_musl: ${{ steps.check.outputs.skip_linux_arm64_musl }}
|
|
||||||
skip_windows_x64: ${{ steps.check.outputs.skip_windows_x64 }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@ -123,8 +114,8 @@ jobs:
|
|||||||
cd packages/${PLATFORM}
|
cd packages/${PLATFORM}
|
||||||
|
|
||||||
if [ "$PLATFORM" = "windows-x64" ]; then
|
if [ "$PLATFORM" = "windows-x64" ]; then
|
||||||
# Windows: use zip
|
# Windows: use 7z (pre-installed on windows-latest)
|
||||||
zip -r ../../binary-${PLATFORM}.zip bin/ package.json
|
7z a -tzip ../../binary-${PLATFORM}.zip bin/ package.json
|
||||||
else
|
else
|
||||||
# Unix: use tar.gz
|
# Unix: use tar.gz
|
||||||
tar -czvf ../../binary-${PLATFORM}.tar.gz bin/ package.json
|
tar -czvf ../../binary-${PLATFORM}.tar.gz bin/ package.json
|
||||||
@ -160,35 +151,29 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
platform: [darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, windows-x64]
|
platform: [darwin-arm64, darwin-x64, linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, windows-x64]
|
||||||
steps:
|
steps:
|
||||||
- name: Check if should skip
|
- name: Check if already published
|
||||||
id: should_skip
|
id: check
|
||||||
run: |
|
run: |
|
||||||
PLATFORM="${{ matrix.platform }}"
|
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
||||||
PLATFORM_KEY="${PLATFORM//-/_}"
|
VERSION="${{ inputs.version }}"
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/${PKG_NAME}/${VERSION}")
|
||||||
# Check the corresponding skip output from build job
|
if [ "$STATUS" = "200" ]; then
|
||||||
case "$PLATFORM" in
|
echo "skip=true" >> $GITHUB_OUTPUT
|
||||||
darwin-arm64) SKIP="${{ needs.build.outputs.skip_darwin_arm64 }}" ;;
|
echo "✓ ${PKG_NAME}@${VERSION} already published, skipping"
|
||||||
darwin-x64) SKIP="${{ needs.build.outputs.skip_darwin_x64 }}" ;;
|
else
|
||||||
linux-x64) SKIP="${{ needs.build.outputs.skip_linux_x64 }}" ;;
|
echo "skip=false" >> $GITHUB_OUTPUT
|
||||||
linux-arm64) SKIP="${{ needs.build.outputs.skip_linux_arm64 }}" ;;
|
echo "→ ${PKG_NAME}@${VERSION} will be published"
|
||||||
linux-x64-musl) SKIP="${{ needs.build.outputs.skip_linux_x64_musl }}" ;;
|
fi
|
||||||
linux-arm64-musl) SKIP="${{ needs.build.outputs.skip_linux_arm64_musl }}" ;;
|
|
||||||
windows-x64) SKIP="${{ needs.build.outputs.skip_windows_x64 }}" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "skip=${SKIP:-false}" >> $GITHUB_OUTPUT
|
|
||||||
echo "Platform: $PLATFORM, Skip: ${SKIP:-false}"
|
|
||||||
|
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
if: steps.should_skip.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true'
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: binary-${{ matrix.platform }}
|
name: binary-${{ matrix.platform }}
|
||||||
path: .
|
path: .
|
||||||
|
|
||||||
- name: Extract artifact
|
- name: Extract artifact
|
||||||
if: steps.should_skip.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true'
|
||||||
run: |
|
run: |
|
||||||
PLATFORM="${{ matrix.platform }}"
|
PLATFORM="${{ matrix.platform }}"
|
||||||
mkdir -p packages/${PLATFORM}
|
mkdir -p packages/${PLATFORM}
|
||||||
@ -204,13 +189,13 @@ jobs:
|
|||||||
ls -la packages/${PLATFORM}/bin/
|
ls -la packages/${PLATFORM}/bin/
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
if: steps.should_skip.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true'
|
||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Publish ${{ matrix.platform }}
|
- name: Publish ${{ matrix.platform }}
|
||||||
if: steps.should_skip.outputs.skip != 'true'
|
if: steps.check.outputs.skip != 'true'
|
||||||
run: |
|
run: |
|
||||||
cd packages/${{ matrix.platform }}
|
cd packages/${{ matrix.platform }}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user