Skip to content

Commit

Permalink
chore(frontend): make publishing more correct (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodin authored Sep 8, 2021
1 parent 6a4426e commit 470a5e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/frontend-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ jobs:
GIT_RELEASE_TOKEN: ${{ secrets.GIT_RELEASE_TOKEN }}
REPO: ${{ github.repository }}
VERSION_TAG: ${{ github.event.release.tag_name }}
- name: Re-build New Version
run: npm run build
- name: Publish
run: |
npx lerna publish --dist-tag \
npx lerna publish from-package --dist-tag \
"$([[ ${{ github.event.release.tag_name }} =~ alpha|beta|rc ]] && echo "next" || echo "latest")"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
15 changes: 10 additions & 5 deletions frontend/scripts/bump/update-package-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ async function updatePackageRegistrations() {
await Promise.all(
packages.map(async (_package) => {
const indexFile = resolve(packagesRoot, _package, 'src/index.ts');
const content = await readFile(indexFile, 'utf8');
const updated = content.replace(versionPattern, `version: /* updated-by-script */ '${version}',`);
await writeFile(indexFile, updated, 'utf8');

log(`@vaadin/${_package} registration updated`);
const packageFile = resolve(packagesRoot, _package, 'package.json');
const [indexContent, packageContent] = await Promise.all([
readFile(indexFile, 'utf8'),
readFile(packageFile, 'utf8'),
]);
const indexUpdated = indexContent.replace(versionPattern, `version: /* updated-by-script */ '${version}',`);
const packageUpdated = JSON.stringify({ ...JSON.parse(packageContent), version }, null, 2);
await Promise.all([writeFile(indexFile, indexUpdated, 'utf8'), writeFile(packageFile, packageUpdated, 'utf8')]);

log(`@vaadin/${_package} version and registration updated`);
})
);
}
Expand Down

0 comments on commit 470a5e5

Please sign in to comment.