Skip to content

Commit 55e39bd

Browse files
committed
ensure that routes file is published
1 parent afec057 commit 55e39bd

File tree

2 files changed

+67
-16
lines changed

2 files changed

+67
-16
lines changed

.github/workflows/node.js.yml

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v4
23+
2324
- name: 🟢 Use Node.js
2425
uses: actions/setup-node@v4
2526
with:
2627
node-version: 20
2728
registry-url: "https://registry.npmjs.org"
2829

30+
- name: Enable Corepack
31+
run: |
32+
corepack enable
33+
corepack prepare yarn@4.9.2 --activate
34+
2935
- name: 💾 Cache dependencies
3036
id: cache
3137
uses: actions/cache@v4
@@ -43,8 +49,11 @@ jobs:
4349
repo-token: ${{ secrets.GITHUB_TOKEN }}
4450
server-token: ${{ env.TURBO_TOKEN }}
4551

46-
- run: yarn verify
47-
- run: yarn turbo run build --color --concurrency=5
52+
- name: ✅ Verify
53+
run: yarn verify
54+
55+
- name: 🛠️ Build
56+
run: yarn turbo run build --color --concurrency=5
4857

4958
- name: 📤 Upload Artifacts
5059
uses: actions/upload-artifact@v4
@@ -56,9 +65,7 @@ jobs:
5665

5766
pre_release:
5867
runs-on: ubuntu-latest
59-
6068
needs: build
61-
6269
if: ${{ github.event_name == 'push' }}
6370

6471
steps:
@@ -73,6 +80,11 @@ jobs:
7380
node-version: 20
7481
registry-url: "https://registry.npmjs.org"
7582

83+
- name: Enable Corepack
84+
run: |
85+
corepack enable
86+
corepack prepare yarn@4.9.2 --activate
87+
7688
- name: 💾 Cache dependencies
7789
id: cache
7890
uses: actions/cache@v4
@@ -96,12 +108,28 @@ jobs:
96108
- name: 🛠️ Build
97109
run: yarn turbo run build --color --concurrency=5
98110

99-
- run: git config user.email "<>" && git config user.name "UgandaEMR CI"
100-
- run: git add . && git commit -m "Prerelease version" --no-verify
101-
102-
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next
111+
- name: ✅ Verify package contains routes.json
112+
run: |
113+
yarn pack --out package.tgz
114+
tar -tf package.tgz | grep -E '^package/routes.json$' || (echo "root routes.json missing from tarball" && exit 1)
115+
116+
- name: Commit prerelease version
117+
run: |
118+
git config user.email "<>"
119+
git config user.name "UgandaEMR CI"
120+
git add .
121+
git commit -m "Prerelease version" --no-verify
122+
123+
- name: 🚢 Publish prerelease
124+
run: |
125+
yarn config set npmAuthToken "${NPM_AUTH_TOKEN}"
126+
yarn npm publish --access public --tag next
103127
env:
104-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
128+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
129+
130+
- name: Cleanup tarball
131+
if: always()
132+
run: rm -f package.tgz
105133

106134
- name: 📤 Upload Artifacts
107135
uses: actions/upload-artifact@v4
@@ -113,21 +141,26 @@ jobs:
113141

114142
release:
115143
runs-on: ubuntu-latest
116-
117144
needs: build
118-
119145
if: ${{ github.event_name == 'release' }}
120146

121147
steps:
122148
- uses: actions/checkout@v4
149+
123150
- name: 📥 Download Artifacts
124151
uses: actions/download-artifact@v4
152+
125153
- name: 🟢 Use Node.js
126154
uses: actions/setup-node@v4
127155
with:
128156
node-version: 20
129157
registry-url: "https://registry.npmjs.org"
130158

159+
- name: Enable Corepack
160+
run: |
161+
corepack enable
162+
corepack prepare yarn@4.9.2 --activate
163+
131164
- name: 💾 Cache dependencies
132165
id: cache
133166
uses: actions/cache@v4
@@ -139,8 +172,21 @@ jobs:
139172
if: steps.cache.outputs.cache-hit != 'true'
140173
run: yarn install --immutable
141174

142-
- run: yarn turbo run build --color
175+
- name: 🛠️ Build
176+
run: yarn turbo run build --color
177+
178+
- name: ✅ Verify package contains routes.json
179+
run: |
180+
yarn pack --out package.tgz
181+
tar -tf package.tgz | grep -E '^package/routes.json$' || (echo "root routes.json missing from tarball" && exit 1)
182+
143183
- name: 🚢 Publish
144-
run: yarn run ci:publish
184+
run: |
185+
yarn config set npmAuthToken "${NPM_AUTH_TOKEN}"
186+
yarn npm publish --access public
145187
env:
146-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
188+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
189+
190+
- name: Cleanup tarball
191+
if: always()
192+
run: rm -f package.tgz

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
"browser": "dist/esm-patient-queues-app.js",
77
"main": "src/index.ts",
88
"source": true,
9+
"files": [
10+
"*"
11+
],
912
"scripts": {
10-
"start": "openmrs develop ",
13+
"start": "openmrs develop",
1114
"serve": "webpack serve --mode=development",
1215
"debug": "npm run serve",
1316
"build": "webpack --mode production",
@@ -17,7 +20,9 @@
1720
"prettier": "prettier --config prettier.config.js --write \"src/**/*.{ts,tsx,css,scss}\"",
1821
"test": "cross-env TZ=UTC jest --config jest.config.json --verbose false --passWithNoTests",
1922
"typescript": "tsc",
20-
"extract-translations": "i18next 'src/**/*.component.tsx' --config ../../tools/i18next-parser.config.js"
23+
"extract-translations": "i18next 'src/**/*.component.tsx' --config ../../tools/i18next-parser.config.js",
24+
"prepack": "cp src/routes.json routes.json",
25+
"postpack": "rm -f routes.json"
2126
},
2227
"browserslist": [
2328
"extends browserslist-config-openmrs"

0 commit comments

Comments
 (0)