Commit 72a729c bulldozer-balena[bot]
authored
File tree 3 files changed +26
-10
lines changed
3 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -90,11 +90,21 @@ export async function run(
90
90
let buildOptions = null ;
91
91
92
92
// If we are pushing directly to the target branch then just build a release without draft flag
93
- if ( context . eventName === 'push' && context . ref === `refs/heads/${ target } ` ) {
93
+ if (
94
+ context . eventName === 'push' &&
95
+ ( context . ref === `refs/heads/${ target } ` ||
96
+ context . ref . startsWith ( 'refs/tags/' ) )
97
+ ) {
98
+ // TODO: Update this to use ref_type & ref_name once that becomes available
99
+ // See: https://github.com/actions/toolkit/pull/935/files
100
+ const tagName = context . ref . match ( / ^ r e f s \/ t a g s \/ ( .+ ) $ / ) ?. [ 1 ] ;
94
101
// Make a final release because context is master workflow
95
102
buildOptions = {
96
103
draft : false ,
97
- tags : { sha : context . sha } ,
104
+ tags : {
105
+ sha : context . sha ,
106
+ ...( ! ! tagName && { tag : tagName } ) ,
107
+ } ,
98
108
} ;
99
109
} else if ( context . eventName !== 'pull_request' ) {
100
110
// Make sure the only events now are Pull Requests
Original file line number Diff line number Diff line change @@ -5,9 +5,16 @@ import * as balena from 'balena-sdk';
5
5
6
6
import { Release } from './types' ;
7
7
8
+ const TagKeyMap = {
9
+ sha : 'balena-ci-commit-sha' ,
10
+ pullRequestId : 'balena-ci-id' ,
11
+ tag : 'balena-ci-git-tag' ,
12
+ } ;
13
+
8
14
type Tags = {
9
15
sha : string ;
10
16
pullRequestId ?: number ;
17
+ tag ?: string ;
11
18
} ;
12
19
13
20
type BuildOptions = {
@@ -76,15 +83,14 @@ export async function push(
76
83
'--source' ,
77
84
source ,
78
85
'--release-tag' ,
79
- 'balena-ci-commit-sha' ,
80
- buildOpt . tags . sha ,
86
+ ...Object . entries ( buildOpt . tags ) . flatMap ( ( [ key , value ] ) => [
87
+ TagKeyMap [ key as keyof typeof TagKeyMap ] ,
88
+ typeof value === 'string' && value . includes ( ' ' )
89
+ ? `"${ value } "`
90
+ : String ( value ) ,
91
+ ] ) ,
81
92
] ;
82
93
83
- if ( buildOpt . tags . pullRequestId ) {
84
- pushOpt . push ( 'balena-ci-id' ) ;
85
- pushOpt . push ( buildOpt . tags . pullRequestId . toString ( ) ) ;
86
- }
87
-
88
94
if ( buildOpt . draft ) {
89
95
pushOpt . push ( '--draft' ) ;
90
96
}
Original file line number Diff line number Diff line change 7
7
"removeComments" : true ,
8
8
"sourceMap" : true ,
9
9
"strict" : true ,
10
- "target" : "es2015 " ,
10
+ "target" : "es2019 " ,
11
11
"declaration" : true ,
12
12
"skipLibCheck" : true ,
13
13
} ,
You can’t perform that action at this time.
0 commit comments