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
run: npm install
- name: Build
env:
PUBLISH: 1
run: |
npm run generate:sources
npm run docs
- name: Version docs
working-directory: ./website

View File

@ -77,20 +77,21 @@ const INCLUDED_FOLDERS = ['common', 'node', 'generated', 'util'];
.outputs(['src/types.ts'])
.build();
job('', async ({inputs, outputs}) => {
if (process.env['PUBLISH']) {
job('', async ({inputs}) => {
const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version;
await writeFile(
outputs[0]!,
inputs[1]!,
(
await readFile(outputs[0]!, {
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();
}
job('', async ({inputs, outputs}) => {
const version = JSON.parse(await readFile(inputs[0]!, 'utf8')).version;