v10.40.0-beta.2 #140
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] | |
| 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@v6 | |
| 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 | |
| publish_with_harmony: | |
| needs: check_changes | |
| 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: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| 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: 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 | |
| if: needs.check_changes.outputs.harmony_changed == 'false' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| 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: 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 | |
| - 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 |