v10.47.0 #169
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Package to npmjs | |
| on: | |
| release: | |
| types: [published] | |
| env: | |
| RELEASE_VERSION: ${{ github.event.release.tag_name || github.ref_name }} | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| check_changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| harmony_changed: ${{ steps.check.outputs.changed }} | |
| prev_tag: ${{ steps.check.outputs.prev_tag }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check Harmony changes | |
| id: check | |
| shell: bash | |
| run: | | |
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT | |
| if [ -z "$PREV_TAG" ]; then | |
| echo "No previous tag found, assuming harmony changed." | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| echo "Previous tag is $PREV_TAG" | |
| if git diff --name-only "$PREV_TAG" HEAD | grep -q '^harmony/'; then | |
| echo "harmony directory changed." | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "harmony directory has NO changes." | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| # Rebuild the Android native libraries from source so the published package | |
| # can never ship a stale librnupdate.so after a cpp/patch_core change (the | |
| # committed binaries are for local dev / git installs only). | |
| build_android_so: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Install pinned NDK | |
| run: echo "y" | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;28.2.13676358" | |
| - name: Build and verify native libraries | |
| run: bash scripts/build-android-so.sh | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-so | |
| path: android/lib/ | |
| if-no-files-found: error | |
| publish_with_harmony: | |
| needs: [check_changes, build_android_so] | |
| if: needs.check_changes.outputs.harmony_changed == 'true' | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/sanchuanhehe/harmony-next-pipeline-docker/harmonyos-ci-image:latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Configure git safe.directory | |
| run: | | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$sm_path"' | |
| - uses: oven-sh/setup-bun@v2 | |
| # Setup .npmrc file to publish to npm | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: bun install --frozen-lockfile | |
| - name: Use CI-built Android native libraries | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: android-so | |
| path: android/lib | |
| - name: Verify Android native libraries | |
| run: node scripts/verify-android-so.js | |
| - name: Build Harmony HAR | |
| run: npm run build:harmony-har -- --build-mode release | |
| - name: Verify Harmony HAR artifact | |
| run: test -f harmony/pushy.har | |
| - name: Publish to npm | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event.release.tag_name }}" == *"beta"* ]]; then | |
| npm publish --provenance --access public --tag beta | |
| else | |
| npm publish --provenance --access public | |
| fi | |
| publish_without_harmony: | |
| needs: [check_changes, build_android_so] | |
| if: needs.check_changes.outputs.harmony_changed == 'false' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - name: Configure git safe.directory | |
| run: | | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$sm_path"' | |
| - uses: oven-sh/setup-bun@v2 | |
| # Setup .npmrc file to publish to npm | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: bun install --frozen-lockfile | |
| - name: Use CI-built Android native libraries | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: android-so | |
| path: android/lib | |
| - name: Verify Android native libraries | |
| run: node scripts/verify-android-so.js | |
| - name: Fetch previous Harmony HAR | |
| shell: bash | |
| run: | | |
| PREV_VERSION="${{ needs.check_changes.outputs.prev_tag }}" | |
| PREV_VERSION="${PREV_VERSION#v}" | |
| echo "Attempting to fetch harmony/pushy.har from react-native-update@$PREV_VERSION" | |
| npm pack react-native-update@$PREV_VERSION || true | |
| tar -xzf react-native-update-${PREV_VERSION}.tgz package/harmony/pushy.har || true | |
| if [ -f package/harmony/pushy.har ]; then | |
| mkdir -p harmony | |
| cp package/harmony/pushy.har harmony/pushy.har | |
| echo "Successfully restored pushy.har from previous release." | |
| else | |
| echo "No harmony/pushy.har found in previous release or fetch failed." | |
| fi | |
| # Clean up temporary pack and extraction files to prevent publishing them | |
| rm -rf react-native-update-${PREV_VERSION}.tgz package || true | |
| - name: Publish to npm | |
| shell: bash | |
| run: | | |
| if [[ "${{ github.event.release.tag_name }}" == *"beta"* ]]; then | |
| npm publish --provenance --access public --tag beta | |
| else | |
| npm publish --provenance --access public | |
| fi |