Skip to content

Commit 1e1a4ad

Browse files
committed
publish
1 parent ead5af4 commit 1e1a4ad

3 files changed

Lines changed: 81 additions & 5 deletions

File tree

.github/workflows/publish.yml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,38 @@ permissions:
88
contents: read
99

1010
jobs:
11-
build:
11+
check_changes:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
harmony_changed: ${{ steps.check.outputs.changed }}
15+
prev_tag: ${{ steps.check.outputs.prev_tag }}
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
fetch-depth: 0
20+
- name: Check Harmony changes
21+
id: check
22+
shell: bash
23+
run: |
24+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
25+
echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT
26+
if [ -z "$PREV_TAG" ]; then
27+
echo "No previous tag found, assuming harmony changed."
28+
echo "changed=true" >> $GITHUB_OUTPUT
29+
exit 0
30+
fi
31+
echo "Previous tag is $PREV_TAG"
32+
if git diff --name-only "$PREV_TAG" HEAD | grep -q '^harmony/'; then
33+
echo "harmony directory changed."
34+
echo "changed=true" >> $GITHUB_OUTPUT
35+
else
36+
echo "harmony directory has NO changes."
37+
echo "changed=false" >> $GITHUB_OUTPUT
38+
fi
39+
40+
publish_with_harmony:
41+
needs: check_changes
42+
if: needs.check_changes.outputs.harmony_changed == 'true'
1243
runs-on: ubuntu-latest
1344
container: ghcr.io/sanchuanhehe/harmony-next-pipeline-docker/harmonyos-ci-image:latest
1445
timeout-minutes: 10
@@ -39,3 +70,47 @@ jobs:
3970
else
4071
npm publish --provenance --access public
4172
fi
73+
74+
publish_without_harmony:
75+
needs: check_changes
76+
if: needs.check_changes.outputs.harmony_changed == 'false'
77+
runs-on: ubuntu-latest
78+
timeout-minutes: 10
79+
steps:
80+
- uses: actions/checkout@v6
81+
with:
82+
submodules: recursive
83+
- name: Configure git safe.directory
84+
run: |
85+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
86+
git submodule foreach --recursive 'git config --global --add safe.directory "$toplevel/$sm_path"'
87+
- uses: oven-sh/setup-bun@v2
88+
# Setup .npmrc file to publish to npm
89+
- uses: actions/setup-node@v6
90+
with:
91+
node-version: 24
92+
registry-url: 'https://registry.npmjs.org'
93+
- run: bun install --frozen-lockfile
94+
- name: Fetch previous Harmony HAR
95+
shell: bash
96+
run: |
97+
PREV_VERSION="${{ needs.check_changes.outputs.prev_tag }}"
98+
PREV_VERSION="${PREV_VERSION#v}"
99+
echo "Attempting to fetch harmony/pushy.har from react-native-update@$PREV_VERSION"
100+
npm pack react-native-update@$PREV_VERSION || true
101+
tar -xzf react-native-update-${PREV_VERSION}.tgz package/harmony/pushy.har || true
102+
if [ -f package/harmony/pushy.har ]; then
103+
mkdir -p harmony
104+
cp package/harmony/pushy.har harmony/pushy.har
105+
echo "Successfully restored pushy.har from previous release."
106+
else
107+
echo "No harmony/pushy.har found in previous release or fetch failed."
108+
fi
109+
- name: Publish to npm
110+
shell: bash
111+
run: |
112+
if [[ "${{ github.event.release.tag_name }}" == *"beta"* ]]; then
113+
npm publish --provenance --access public --tag beta
114+
else
115+
npm publish --provenance --access public
116+
fi

Example/testHotUpdate/bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/testHotUpdate/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"lint": "eslint .",
1313
"postinstall": "patch-package",
1414
"apk": "cd android && ./gradlew assembleRelease",
15-
"aab": "cd android && ./gradlew bundleRelease"
15+
"aab": "cd android && ./gradlew bundleRelease",
16+
"aa": "cd android && ./gradlew assembleRelease bundleRelease"
1617
},
1718
"dependencies": {
1819
"form-data": "^4.0.5",
@@ -23,7 +24,7 @@
2324
"react-native-paper": "^5.15.0",
2425
"react-native-safe-area-context": "^5.7.0",
2526
"react-native-svg": "^15.15.4",
26-
"react-native-update": "^10.38.0-beta.3",
27+
"react-native-update": "^10.39.0-beta.3",
2728
"react-native-vector-icons": "^10.3.0"
2829
},
2930
"devDependencies": {

0 commit comments

Comments
 (0)