@@ -29,9 +29,12 @@ test.serial('Publish a release', async t => {
2929 const encodedRepoId = encodeURIComponent ( `${ owner } /${ repo } ` ) ;
3030 const encodedGitTag = encodeURIComponent ( nextRelease . gitTag ) ;
3131 const gitlab = authenticate ( env )
32- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
32+ . post ( `/projects/${ encodedRepoId } /releases ` , {
3333 tag_name : nextRelease . gitTag ,
3434 description : nextRelease . notes ,
35+ assets : {
36+ links : [ ] ,
37+ } ,
3538 } )
3639 . reply ( 200 ) ;
3740
@@ -54,20 +57,22 @@ test.serial('Publish a release with assets', async t => {
5457 const uploaded = { url : '/uploads/file.css' , alt : 'file.css' } ;
5558 const assets = [ [ '**' , '!**/*.txt' , '!.dotfile' ] ] ;
5659 const gitlab = authenticate ( env )
57- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
60+ . post ( `/projects/${ encodedRepoId } /releases ` , {
5861 tag_name : nextRelease . gitTag ,
5962 description : nextRelease . notes ,
63+ assets : {
64+ links : [
65+ {
66+ name : uploaded . alt ,
67+ url : `https://gitlab.com/${ owner } /${ repo } ${ uploaded . url } ` ,
68+ } ,
69+ ] ,
70+ } ,
6071 } )
6172 . reply ( 200 ) ;
6273 const gitlabUpload = authenticate ( env )
6374 . post ( `/projects/${ encodedRepoId } /uploads` , / f i l e n a m e = " f i l e .c s s " / gm)
6475 . 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 , { } ) ;
7176
7277 const result = await publish ( { assets} , { env, cwd, options, nextRelease, logger : t . context . logger } ) ;
7378
@@ -76,7 +81,6 @@ test.serial('Publish a release with assets', async t => {
7681 t . deepEqual ( t . context . log . args [ 1 ] , [ 'Published GitLab release: %s' , nextRelease . gitTag ] ) ;
7782 t . true ( gitlabUpload . isDone ( ) ) ;
7883 t . true ( gitlab . isDone ( ) ) ;
79- t . true ( gitlabAssetLink . isDone ( ) ) ;
8084} ) ;
8185
8286test . 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 => {
9195 const emptyDirectory = tempy . directory ( ) ;
9296 const assets = [ emptyDirectory , { path : 'missing.txt' , label : 'missing.txt' } ] ;
9397 const gitlab = authenticate ( env )
94- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
98+ . post ( `/projects/${ encodedRepoId } /releases ` , {
9599 tag_name : nextRelease . gitTag ,
96100 description : nextRelease . notes ,
101+ assets : {
102+ links : [ ] ,
103+ } ,
97104 } )
98105 . reply ( 200 ) ;
99106 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 => {
116123 const assetLabel = 'Custom Label' ;
117124 const assets = [ { path : 'upload.txt' , label : assetLabel } ] ;
118125 const gitlab = authenticate ( env )
119- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
126+ . post ( `/projects/${ encodedRepoId } /releases ` , {
120127 tag_name : nextRelease . gitTag ,
121128 description : nextRelease . notes ,
129+ assets : {
130+ links : [
131+ {
132+ name : assetLabel ,
133+ url : `https://gitlab.com/${ owner } /${ repo } ${ uploaded . url } ` ,
134+ } ,
135+ ] ,
136+ } ,
122137 } )
123138 . reply ( 200 ) ;
124139 const gitlabUpload = authenticate ( env )
125140 . post ( `/projects/${ encodedRepoId } /uploads` , / f i l e n a m e = " u p l o a d .t x t " / gm)
126141 . 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 , { } ) ;
133142
134143 const result = await publish ( { assets} , { env, cwd, options, nextRelease, logger : t . context . logger } ) ;
135144
@@ -138,10 +147,9 @@ test.serial('Publish a release with one asset and custom label', async t => {
138147 t . deepEqual ( t . context . log . args [ 1 ] , [ 'Published GitLab release: %s' , nextRelease . gitTag ] ) ;
139148 t . true ( gitlabUpload . isDone ( ) ) ;
140149 t . true ( gitlab . isDone ( ) ) ;
141- t . true ( gitlabAssetLink . isDone ( ) ) ;
142150} ) ;
143151
144- test . serial ( 'Publish a release with missing releasae notes' , async t => {
152+ test . serial ( 'Publish a release with missing release notes' , async t => {
145153 const owner = 'test_user' ;
146154 const repo = 'test_repo' ;
147155 const env = { GITLAB_TOKEN : 'gitlab_token' } ;
@@ -151,9 +159,12 @@ test.serial('Publish a release with missing releasae notes', async t => {
151159 const encodedRepoId = encodeURIComponent ( `${ owner } /${ repo } ` ) ;
152160 const encodedGitTag = encodeURIComponent ( nextRelease . gitTag ) ;
153161 const gitlab = authenticate ( env )
154- . post ( `/projects/${ encodedRepoId } /repository/tags/ ${ encodedGitTag } /release ` , {
162+ . post ( `/projects/${ encodedRepoId } /releases ` , {
155163 tag_name : nextRelease . gitTag ,
156164 description : nextRelease . gitTag ,
165+ assets : {
166+ links : [ ] ,
167+ } ,
157168 } )
158169 . reply ( 200 ) ;
159170
0 commit comments