2
2
* Semantic Release Config
3
3
*/
4
4
5
- import fs from 'fs/promises' ;
6
- import path from 'path' ;
5
+ import { readFile } from 'fs/promises' ;
6
+ import { resolve , dirname } from 'path' ;
7
+ import { fileURLToPath } from 'url' ;
7
8
8
9
// Get env vars
9
- const ref = process . env . GITHUB_REF ;
10
+ const ref = process . env . GITHUB_REF || '' ;
10
11
const serverUrl = process . env . GITHUB_SERVER_URL ;
11
12
const repository = process . env . GITHUB_REPOSITORY ;
12
13
const repositoryUrl = serverUrl + '/' + repository ;
@@ -38,6 +39,7 @@ async function config() {
38
39
const config = {
39
40
branches : [
40
41
'master' ,
42
+ 'ci/fix-auto-release' ,
41
43
// { name: 'alpha', prerelease: true },
42
44
// { name: 'beta', prerelease: true },
43
45
// 'next-major',
@@ -49,7 +51,7 @@ async function config() {
49
51
] ,
50
52
dryRun : true ,
51
53
debug : true ,
52
- ci : true ,
54
+ ci : false ,
53
55
tagFormat : '${version}' ,
54
56
plugins : [
55
57
[ '@semantic-release/commit-analyzer' , {
@@ -97,19 +99,17 @@ async function config() {
97
99
98
100
async function loadTemplates ( ) {
99
101
for ( const template of Object . keys ( templates ) ) {
100
- const text = await readFile ( path . resolve ( __dirname , resourcePath , templates [ template ] . file ) ) ;
102
+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
103
+ const filePath = resolve ( __dirname , resourcePath , templates [ template ] . file ) ;
104
+ const text = await readFile ( filePath , 'utf-8' ) ;
101
105
templates [ template ] . text = text ;
102
106
}
103
107
}
104
108
105
- async function readFile ( filePath ) {
106
- return await fs . readFile ( filePath , 'utf-8' ) ;
107
- }
108
-
109
109
function getReleaseComment ( ) {
110
110
const url = repositoryUrl + '/releases/tag/${nextRelease.gitTag}' ;
111
111
let comment = '🎉 This change has been released in version [${nextRelease.version}](' + url + ')' ;
112
112
return comment ;
113
113
}
114
114
115
- module . exports = config ( ) ;
115
+ export default config ( ) ;
0 commit comments