File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
netlify-cms-backend-gitlab/src
netlify-cms-core/src/components/Releases Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -1015,4 +1015,30 @@ export default class API {
10151015 const mergeRequest = await this . getBranchMergeRequest ( branch ) ;
10161016 return mergeRequest . sha ;
10171017 }
1018+
1019+ async listReleases ( ) {
1020+ console . log (
1021+ '%c Loading releases' ,
1022+ 'line-height: 30px;text-align: center;font-weight: bold' ,
1023+ ) ;
1024+
1025+ return this . request ( `${ this . repoURL } /releases` )
1026+ }
1027+
1028+ async publishRelease ( version : string ) {
1029+ console . log (
1030+ `%c Publishing release ${ version } ` ,
1031+ 'line-height: 30px;text-align: center;font-weight: bold' ,
1032+ ) ;
1033+
1034+ return this . requestJSON ( {
1035+ url : `${ this . repoURL } /releases` ,
1036+ method : 'POST' ,
1037+ headers : { 'Content-Type' : 'application/json; charset=utf-8' } ,
1038+ body : JSON . stringify ( {
1039+ tag_name : version ,
1040+ ref : this . branch ,
1041+ } ) ,
1042+ } ) ;
1043+ }
10181044}
Original file line number Diff line number Diff line change @@ -453,4 +453,22 @@ export default class GitLab implements Implementation {
453453 return null ;
454454 }
455455 }
456+
457+ async listReleases ( ) {
458+ try {
459+ const response = await this . api ! . listReleases ( ) ;
460+ const json = await response . json ( )
461+ return json ;
462+ } catch ( e ) {
463+ return [ ] ;
464+ }
465+ }
466+
467+ async publishRelease ( version : string ) {
468+ try {
469+ return await this . api ! . publishRelease ( version ) ;
470+ } catch ( e ) {
471+ return ;
472+ }
473+ }
456474}
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ class Releases extends Component {
8080 < ul >
8181 { releases . map ( release => (
8282 < li key = { release . tag_name } >
83- < a href = { release . html_url } >
83+ < a href = { release . html_url || release . _links . self } >
8484 { release . tag_name }
8585 </ a >
8686 </ li >
You can’t perform that action at this time.
0 commit comments