Skip to content

Commit 2970d7d

Browse files
committed
feat: add publish next version for rn-new in addition to create-expo-stack
1 parent e230be0 commit 2970d7d

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

.github/workflows/next-release.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,26 @@ jobs:
8989
- name: Bump next version
9090
run: bun run ./scripts/next-release.ts
9191

92+
- name: Build rn-new
93+
run: bun run build:rn-new
94+
9295
## Unfortunately, bun doesn't support publishing to NPM registry yet
9396
- name: Setup Node.js
9497
uses: actions/setup-node@v3
9598
with:
9699
node-version: latest
97100

98-
- name: Authenticate to npm and publish
101+
- name: Authenticate to npm and publish both packages
99102
env:
100103
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
101104
run: |
102-
bun run build:cli
103105
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
106+
107+
# Publish create-expo-stack@next
104108
cd ./cli
105109
npm publish --provenance --access public --ignore-scripts --tag next
110+
cd ..
111+
112+
# Publish rn-new@next
113+
cd ./packages/rn-new
114+
npm publish --provenance --access public --ignore-scripts --tag next

scripts/next-release.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,31 @@ async function createNextRelease() {
1212
* Parse the package.json for `create-expo-stack`, and update it with the new
1313
* "next" (development) version based on the parsed changesets
1414
*/
15-
const packageJson = await Bun.file(process.cwd() + '/cli/package.json').json();
16-
const newNextVersion = releasePlan.releases.find((release) => release.name === packageJson.name)?.newVersion;
15+
const cliPackageJson = await Bun.file(process.cwd() + '/cli/package.json').json();
16+
const newNextVersion = releasePlan.releases.find((release) => release.name === cliPackageJson.name)?.newVersion;
1717

1818
if (newNextVersion) {
19+
const nextVersionWithHash = `${newNextVersion}-next.${commitHash}`;
20+
1921
/**
20-
* Write the new "next" version to `package.json`. It is an ephemeral change
22+
* Write the new "next" version to `create-expo-stack` package.json. It is an ephemeral change
2123
* that lives only for the duration of the CI run, and is not committed
2224
*/
23-
packageJson.version = `${newNextVersion}-next.${commitHash}`;
25+
cliPackageJson.version = nextVersionWithHash;
26+
27+
const cliContent = JSON.stringify(cliPackageJson, null, '\t') + '\n';
28+
await Bun.write(process.cwd() + '/cli/package.json', cliContent);
29+
30+
/**
31+
* Also update the rn-new package.json with the same version and update its dependency
32+
* on create-expo-stack to match the new next version
33+
*/
34+
const rnNewPackageJson = await Bun.file(process.cwd() + '/packages/rn-new/package.json').json();
35+
rnNewPackageJson.version = nextVersionWithHash;
36+
rnNewPackageJson.dependencies['create-expo-stack'] = `^${nextVersionWithHash}`;
2437

25-
const content = JSON.stringify(packageJson, null, '\t') + '\n';
26-
await Bun.write(process.cwd() + '/cli/package.json', content);
38+
const rnNewContent = JSON.stringify(rnNewPackageJson, null, '\t') + '\n';
39+
await Bun.write(process.cwd() + '/packages/rn-new/package.json', rnNewContent);
2740
}
2841
} catch (error) {
2942
console.log(error);

0 commit comments

Comments
 (0)