@@ -4,8 +4,8 @@ import { AssertionError } from 'assert'
4
4
import chalk from 'chalk'
5
5
import execa from 'execa'
6
6
import fs from 'fs'
7
- import os from 'os'
8
7
import fetch from 'node-fetch'
8
+ import * as core from '@actions/core'
9
9
10
10
/**
11
11
* Turns a prisma-engines Git branch name (that got new engines published) into a
@@ -49,16 +49,20 @@ async function main(dryRun = false) {
49
49
npmDistTag === 'integration'
50
50
? `${ slugify ( githubEventClientPayload . branch ) } -`
51
51
: ''
52
- const nextStable = await getNextPrismaStableVersion ( npmDistTag === 'patch' )
53
- const versionIncrement = await getNextVersionIncrement ( nextStable )
52
+ const nextStable = await getNextPrismaStableVersion ( {
53
+ isPatch : npmDistTag === 'patch' ,
54
+ } )
55
+ const versionIncrement = await getNextVersionIncrement ( {
56
+ versionPrefix : nextStable ,
57
+ } )
54
58
const newVersion = `${ nextStable } -${ versionIncrement } .${ optionalNamePart } ${ githubEventClientPayload . commit } `
55
59
56
60
console . log ( chalk . bold . greenBright ( 'Going to publish:\n' ) )
57
61
console . log ( `${ chalk . bold ( 'New version' ) } ${ newVersion } ` )
58
62
console . log ( `${ chalk . bold ( 'Npm Dist Tag' ) } ${ npmDistTag } \n` )
59
63
// Set GITHUB_OUTPUT
60
- setOutput ( 'new_prisma_version' , newVersion )
61
- setOutput ( 'npm_dist_tag' , npmDistTag )
64
+ core . setOutput ( 'new_prisma_version' , newVersion )
65
+ core . setOutput ( 'npm_dist_tag' , npmDistTag )
62
66
63
67
// @prisma /engines-version
64
68
adjustPkgJson ( 'packages/engines-version/package.json' , ( pkg ) => {
@@ -86,9 +90,11 @@ function setPatchZero(version: string): string {
86
90
}
87
91
88
92
/** Get next stable version of prisma CLI (using Npm) */
89
- async function getNextPrismaStableVersion (
90
- isPatch : boolean ,
91
- ) : Promise < string | null > {
93
+ async function getNextPrismaStableVersion ( {
94
+ isPatch,
95
+ } : {
96
+ isPatch : boolean
97
+ } ) : Promise < string | null > {
92
98
const data = await fetch ( 'https://registry.npmjs.org/prisma' ) . then ( ( res ) =>
93
99
res . json ( ) ,
94
100
)
@@ -102,7 +108,11 @@ async function getNextPrismaStableVersion(
102
108
}
103
109
104
110
/** Get next version increment of engines version (using Npm) */
105
- async function getNextVersionIncrement ( versionPrefix : string ) : Promise < number > {
111
+ async function getNextVersionIncrement ( {
112
+ versionPrefix,
113
+ } : {
114
+ versionPrefix : string
115
+ } ) : Promise < number > {
106
116
console . log ( 'getting increment for prefix' , versionPrefix )
107
117
const data = await fetch (
108
118
'https://registry.npmjs.org/@prisma/engines-version' ,
@@ -230,13 +240,6 @@ async function run(
230
240
}
231
241
}
232
242
233
- // From https://github.com/actions/toolkit/issues/1218#issuecomment-1288890856
234
- function setOutput ( key , value ) {
235
- // Temporary hack until core actions library catches up with github new recommendations
236
- const output = process . env [ 'GITHUB_OUTPUT' ]
237
- fs . appendFileSync ( output , `${ key } =${ value } ${ os . EOL } ` )
238
- }
239
-
240
243
// useful for debugging
241
244
// process.env.GITHUB_EVENT_CLIENT_PAYLOAD = JSON.stringify({
242
245
// branch: 'enabling-node-api',
0 commit comments