@@ -29,9 +29,12 @@ test.serial('Publish a release', async t => {
29
29
const encodedRepoId = encodeURIComponent ( `${ owner } /${ repo } ` ) ;
30
30
const encodedGitTag = encodeURIComponent ( nextRelease . gitTag ) ;
31
31
const gitlab = authenticate ( env )
32
- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
32
+ . post ( `/projects/${ encodedRepoId } /releases ` , {
33
33
tag_name : nextRelease . gitTag ,
34
34
description : nextRelease . notes ,
35
+ assets : {
36
+ links : [ ] ,
37
+ } ,
35
38
} )
36
39
. reply ( 200 ) ;
37
40
@@ -54,20 +57,22 @@ test.serial('Publish a release with assets', async t => {
54
57
const uploaded = { url : '/uploads/file.css' , alt : 'file.css' } ;
55
58
const assets = [ [ '**' , '!**/*.txt' , '!.dotfile' ] ] ;
56
59
const gitlab = authenticate ( env )
57
- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
60
+ . post ( `/projects/${ encodedRepoId } /releases ` , {
58
61
tag_name : nextRelease . gitTag ,
59
62
description : nextRelease . notes ,
63
+ assets : {
64
+ links : [
65
+ {
66
+ name : uploaded . alt ,
67
+ url : `https://gitlab.com/${ owner } /${ repo } ${ uploaded . url } ` ,
68
+ } ,
69
+ ] ,
70
+ } ,
60
71
} )
61
72
. reply ( 200 ) ;
62
73
const gitlabUpload = authenticate ( env )
63
74
. post ( `/projects/${ encodedRepoId } /uploads` , / f i l e n a m e = " f i l e .c s s " / gm)
64
75
. reply ( 200 , uploaded ) ;
65
- const gitlabAssetLink = authenticate ( env )
66
- . post ( `/projects/${ encodedRepoId } /releases/${ encodedGitTag } /assets/links` , {
67
- url : `https://gitlab.com/${ owner } /${ repo } ${ uploaded . url } ` ,
68
- name : uploaded . alt ,
69
- } )
70
- . reply ( 200 , { } ) ;
71
76
72
77
const result = await publish ( { assets} , { env, cwd, options, nextRelease, logger : t . context . logger } ) ;
73
78
@@ -76,7 +81,6 @@ test.serial('Publish a release with assets', async t => {
76
81
t . deepEqual ( t . context . log . args [ 1 ] , [ 'Published GitLab release: %s' , nextRelease . gitTag ] ) ;
77
82
t . true ( gitlabUpload . isDone ( ) ) ;
78
83
t . true ( gitlab . isDone ( ) ) ;
79
- t . true ( gitlabAssetLink . isDone ( ) ) ;
80
84
} ) ;
81
85
82
86
test . serial ( 'Publish a release with array of missing assets' , async t => {
@@ -91,9 +95,12 @@ test.serial('Publish a release with array of missing assets', async t => {
91
95
const emptyDirectory = tempy . directory ( ) ;
92
96
const assets = [ emptyDirectory , { path : 'missing.txt' , label : 'missing.txt' } ] ;
93
97
const gitlab = authenticate ( env )
94
- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
98
+ . post ( `/projects/${ encodedRepoId } /releases ` , {
95
99
tag_name : nextRelease . gitTag ,
96
100
description : nextRelease . notes ,
101
+ assets : {
102
+ links : [ ] ,
103
+ } ,
97
104
} )
98
105
. reply ( 200 ) ;
99
106
const result = await publish ( { assets} , { env, cwd, options, nextRelease, logger : t . context . logger } ) ;
@@ -116,20 +123,22 @@ test.serial('Publish a release with one asset and custom label', async t => {
116
123
const assetLabel = 'Custom Label' ;
117
124
const assets = [ { path : 'upload.txt' , label : assetLabel } ] ;
118
125
const gitlab = authenticate ( env )
119
- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
126
+ . post ( `/projects/${ encodedRepoId } /releases ` , {
120
127
tag_name : nextRelease . gitTag ,
121
128
description : nextRelease . notes ,
129
+ assets : {
130
+ links : [
131
+ {
132
+ name : assetLabel ,
133
+ url : `https://gitlab.com/${ owner } /${ repo } ${ uploaded . url } ` ,
134
+ } ,
135
+ ] ,
136
+ } ,
122
137
} )
123
138
. reply ( 200 ) ;
124
139
const gitlabUpload = authenticate ( env )
125
140
. post ( `/projects/${ encodedRepoId } /uploads` , / f i l e n a m e = " u p l o a d .t x t " / gm)
126
141
. reply ( 200 , uploaded ) ;
127
- const gitlabAssetLink = authenticate ( env )
128
- . post ( `/projects/${ encodedRepoId } /releases/${ encodedGitTag } /assets/links` , {
129
- url : `https://gitlab.com/${ owner } /${ repo } ${ uploaded . url } ` ,
130
- name : assetLabel ,
131
- } )
132
- . reply ( 200 , { } ) ;
133
142
134
143
const result = await publish ( { assets} , { env, cwd, options, nextRelease, logger : t . context . logger } ) ;
135
144
@@ -138,10 +147,9 @@ test.serial('Publish a release with one asset and custom label', async t => {
138
147
t . deepEqual ( t . context . log . args [ 1 ] , [ 'Published GitLab release: %s' , nextRelease . gitTag ] ) ;
139
148
t . true ( gitlabUpload . isDone ( ) ) ;
140
149
t . true ( gitlab . isDone ( ) ) ;
141
- t . true ( gitlabAssetLink . isDone ( ) ) ;
142
150
} ) ;
143
151
144
- test . serial ( 'Publish a release with missing releasae notes' , async t => {
152
+ test . serial ( 'Publish a release with missing release notes' , async t => {
145
153
const owner = 'test_user' ;
146
154
const repo = 'test_repo' ;
147
155
const env = { GITLAB_TOKEN : 'gitlab_token' } ;
@@ -151,9 +159,12 @@ test.serial('Publish a release with missing releasae notes', async t => {
151
159
const encodedRepoId = encodeURIComponent ( `${ owner } /${ repo } ` ) ;
152
160
const encodedGitTag = encodeURIComponent ( nextRelease . gitTag ) ;
153
161
const gitlab = authenticate ( env )
154
- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
162
+ . post ( `/projects/${ encodedRepoId } /releases ` , {
155
163
tag_name : nextRelease . gitTag ,
156
164
description : nextRelease . gitTag ,
165
+ assets : {
166
+ links : [ ] ,
167
+ } ,
157
168
} )
158
169
. reply ( 200 ) ;
159
170
0 commit comments