@@ -10,7 +10,7 @@ export async function run() {
10
10
}
11
11
12
12
try {
13
- let dfxVersion = core . getInput ( 'dfx-version' ) ;
13
+ const dfxVersion = core . getInput ( 'dfx-version' ) ;
14
14
core . info ( `Setup dfx version ${ dfxVersion } ` ) ;
15
15
16
16
// Opt-out of having data collected about dfx usage.
@@ -20,27 +20,36 @@ export async function run() {
20
20
cp . execSync ( `echo y | DFX_VERSION=${ dfxVersion } sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"` ) ;
21
21
core . addPath ( '/home/runner/bin' ) ;
22
22
23
- let dfxPath = await io . which ( 'dfx' ) ;
23
+ const dfxPath = await io . which ( 'dfx' ) ;
24
24
core . debug ( dfxPath ) ;
25
25
infoExec ( `${ dfxPath } --version` ) ;
26
26
27
+ // Setup identity.
28
+ const id : string = process . env [ `DFX_IDENTITY_PEM` ] || '' ;
29
+ if ( id ) {
30
+ cp . execSync ( `${ dfxPath } identity new action` ) ;
31
+ cp . execSync ( `chmod +w /home/runner/.config/dfx/identity/action/identity.pem` )
32
+ cp . execSync ( `echo "${ id } " > /home/runner/.config/dfx/identity/action/identity.pem` ) ;
33
+ infoExec ( `${ dfxPath } identity list` ) ;
34
+ }
35
+
27
36
// Install dfx cache to get moc.
28
37
if ( core . getBooleanInput ( 'install-moc' ) ) {
29
38
cp . execSync ( `${ dfxPath } cache install` ) ;
30
- let cachePath = infoExec ( `${ dfxPath } cache show` ) . trim ( ) ;
39
+ const cachePath = infoExec ( `${ dfxPath } cache show` ) . trim ( ) ;
31
40
core . addPath ( cachePath ) ;
32
41
33
- let mocPath = await io . which ( 'moc' ) ;
42
+ const mocPath = await io . which ( 'moc' ) ;
34
43
infoExec ( `${ mocPath } --version` ) ;
35
44
}
36
45
37
46
// Install vessel.
38
- let vesselVersion = core . getInput ( 'vessel-version' ) ;
47
+ const vesselVersion = core . getInput ( 'vessel-version' ) ;
39
48
if ( vesselVersion ) {
40
49
cp . execSync ( `curl -L https://github.com/dfinity/vessel/releases/download/v${ vesselVersion } /vessel-linux64 > /home/runner/bin/vessel` ) ;
41
50
cp . execSync ( `chmod +x /home/runner/bin/vessel` ) ;
42
51
43
- let vesselPath = await io . which ( 'vessel' ) ;
52
+ const vesselPath = await io . which ( 'vessel' ) ;
44
53
infoExec ( `${ vesselPath } --version` ) ;
45
54
}
46
55
} catch ( e ) {
@@ -49,7 +58,7 @@ export async function run() {
49
58
}
50
59
51
60
function infoExec ( command : string ) : string {
52
- let cmdStr = ( cp . execSync ( command ) || '' ) . toString ( ) ;
61
+ const cmdStr = ( cp . execSync ( command ) || '' ) . toString ( ) ;
53
62
core . info ( cmdStr ) ;
54
63
return cmdStr ;
55
64
}
0 commit comments