chore: generate version on pre-publish (#8872)

This commit is contained in:
jrandolf 2022-08-31 17:21:25 +02:00 committed by GitHub
parent 37906f4708
commit 3499e1292e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 15 deletions

View File

@ -19,8 +19,9 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install
- name: Build - name: Build
env:
PUBLISH: 1
run: | run: |
npm run generate:sources
npm run docs npm run docs
- name: Version docs - name: Version docs
working-directory: ./website working-directory: ./website

View File

@ -77,20 +77,21 @@ const INCLUDED_FOLDERS = ['common', 'node', 'generated', 'util'];
.outputs(['src/types.ts']) .outputs(['src/types.ts'])
.build(); .build();
job('', async ({inputs, outputs}) => { if (process.env['PUBLISH']) {
const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version; job('', async ({inputs}) => {
await writeFile( const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version;
outputs[0]!, await writeFile(
( inputs[1]!,
await readFile(outputs[0]!, { (
encoding: 'utf-8', await readFile(inputs[1]!, {
}) encoding: 'utf-8',
).replace("'NEXT'", `v${version}`) })
); ).replace("'NEXT'", `'v${version}'`)
}) );
.inputs(['package.json']) })
.outputs(['versions.js']) .inputs(['package.json', 'versions.js'])
.build(); .build();
}
job('', async ({inputs, outputs}) => { job('', async ({inputs, outputs}) => {
const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version; const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version;