@@ -50,30 +50,38 @@ function run() {
50
50
return ;
51
51
}
52
52
try {
53
- let dfxVersion = core . getInput ( 'dfx-version' ) ;
53
+ const dfxVersion = core . getInput ( 'dfx-version' ) ;
54
54
core . info ( `Setup dfx version ${ dfxVersion } ` ) ;
55
55
// Opt-out of having data collected about dfx usage.
56
56
core . exportVariable ( 'DFX_TELEMETRY_DISABLED' , 1 ) ;
57
57
// Install dfx.
58
58
child_process_1 . default . execSync ( `echo y | DFX_VERSION=${ dfxVersion } sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"` ) ;
59
59
core . addPath ( '/home/runner/bin' ) ;
60
- let dfxPath = yield io . which ( 'dfx' ) ;
60
+ const dfxPath = yield io . which ( 'dfx' ) ;
61
61
core . debug ( dfxPath ) ;
62
62
infoExec ( `${ dfxPath } --version` ) ;
63
+ // Setup identity.
64
+ const id = process . env [ `DFX_IDENTITY_PEM` ] || '' ;
65
+ if ( id ) {
66
+ child_process_1 . default . execSync ( `${ dfxPath } identity new action` ) ;
67
+ child_process_1 . default . execSync ( `chmod +w /home/runner/.config/dfx/identity/action/identity.pem` ) ;
68
+ child_process_1 . default . execSync ( `echo "${ id } " > /home/runner/.config/dfx/identity/action/identity.pem` ) ;
69
+ infoExec ( `${ dfxPath } identity list` ) ;
70
+ }
63
71
// Install dfx cache to get moc.
64
72
if ( core . getBooleanInput ( 'install-moc' ) ) {
65
73
child_process_1 . default . execSync ( `${ dfxPath } cache install` ) ;
66
- let cachePath = infoExec ( `${ dfxPath } cache show` ) . trim ( ) ;
74
+ const cachePath = infoExec ( `${ dfxPath } cache show` ) . trim ( ) ;
67
75
core . addPath ( cachePath ) ;
68
- let mocPath = yield io . which ( 'moc' ) ;
76
+ const mocPath = yield io . which ( 'moc' ) ;
69
77
infoExec ( `${ mocPath } --version` ) ;
70
78
}
71
79
// Install vessel.
72
- let vesselVersion = core . getInput ( 'vessel-version' ) ;
80
+ const vesselVersion = core . getInput ( 'vessel-version' ) ;
73
81
if ( vesselVersion ) {
74
82
child_process_1 . default . execSync ( `curl -L https://github.com/dfinity/vessel/releases/download/v${ vesselVersion } /vessel-linux64 > /home/runner/bin/vessel` ) ;
75
83
child_process_1 . default . execSync ( `chmod +x /home/runner/bin/vessel` ) ;
76
- let vesselPath = yield io . which ( 'vessel' ) ;
84
+ const vesselPath = yield io . which ( 'vessel' ) ;
77
85
infoExec ( `${ vesselPath } --version` ) ;
78
86
}
79
87
}
@@ -84,7 +92,7 @@ function run() {
84
92
}
85
93
exports . run = run ;
86
94
function infoExec ( command ) {
87
- let cmdStr = ( child_process_1 . default . execSync ( command ) || '' ) . toString ( ) ;
95
+ const cmdStr = ( child_process_1 . default . execSync ( command ) || '' ) . toString ( ) ;
88
96
core . info ( cmdStr ) ;
89
97
return cmdStr ;
90
98
}
0 commit comments