File tree 4 files changed +18
-5
lines changed
4 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1
1
name : Install
2
2
description : Installs the Catalyst-CI CLI
3
3
inputs :
4
+ asset :
5
+ description : Which asset to install from the Catalyst-CI repository
6
+ required : false
7
+ default : cli
4
8
token :
5
9
description : Github token used to query API for available CLI releases
6
10
required : false
Original file line number Diff line number Diff line change @@ -13719,7 +13719,6 @@ var github = __nccwpck_require__(5438);
13719
13719
13720
13720
13721
13721
13722
- const assetName = 'cli-linux-amd64.tar.gz';
13723
13722
const repoOwner = 'input-output-hk';
13724
13723
const repoName = 'catalyst-ci';
13725
13724
async function run(platform = process.platform) {
@@ -13728,8 +13727,10 @@ async function run(platform = process.platform) {
13728
13727
return;
13729
13728
}
13730
13729
try {
13730
+ const assetName = core.getInput('asset');
13731
13731
const token = core.getInput('token');
13732
13732
const version = core.getInput('version');
13733
+ const assetFullName = `${assetName}-linux-amd64.tar.gz`;
13733
13734
if (version !== 'latest' && !isSemVer(version)) {
13734
13735
core.setFailed('Invalid version');
13735
13736
return;
@@ -13750,7 +13751,7 @@ async function run(platform = process.platform) {
13750
13751
core.setFailed(`Version ${version} not found`);
13751
13752
return;
13752
13753
}
13753
- const asset = targetRelease.assets.find(a => a.name === assetName );
13754
+ const asset = targetRelease.assets.find(a => a.name === assetFullName );
13754
13755
if (!asset) {
13755
13756
core.setFailed(`Asset for version v${version} not found`);
13756
13757
return;
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ describe('Setup Action', () => {
51
51
beforeAll ( ( ) => {
52
52
getInputMock . mockImplementation ( ( name : string ) => {
53
53
switch ( name ) {
54
+ case 'asset' :
55
+ return 'cli'
54
56
case 'token' :
55
57
return token
56
58
case 'version' :
@@ -71,6 +73,8 @@ describe('Setup Action', () => {
71
73
beforeAll ( ( ) => {
72
74
getInputMock . mockImplementation ( ( name : string ) => {
73
75
switch ( name ) {
76
+ case 'asset' :
77
+ return 'cli'
74
78
case 'token' :
75
79
return token
76
80
case 'version' :
@@ -103,7 +107,7 @@ describe('Setup Action', () => {
103
107
} )
104
108
105
109
describe ( 'when the version exists' , ( ) => {
106
- describe ( 'when the assets is not found' , ( ) => {
110
+ describe ( 'when the asset is not found' , ( ) => {
107
111
beforeAll ( ( ) => {
108
112
getOctokitMock . mockReturnValue ( {
109
113
rest : {
@@ -199,6 +203,8 @@ describe('Setup Action', () => {
199
203
beforeAll ( ( ) => {
200
204
getInputMock . mockImplementation ( ( name : string ) => {
201
205
switch ( name ) {
206
+ case 'asset' :
207
+ return 'cli'
202
208
case 'token' :
203
209
return token
204
210
case 'version' :
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import * as core from '@actions/core'
2
2
import * as tc from '@actions/tool-cache'
3
3
import * as github from '@actions/github'
4
4
5
- const assetName = 'cli-linux-amd64.tar.gz'
6
5
const repoOwner = 'input-output-hk'
7
6
const repoName = 'catalyst-ci'
8
7
@@ -15,9 +14,12 @@ export async function run(
15
14
}
16
15
17
16
try {
17
+ const assetName = core . getInput ( 'asset' )
18
18
const token = core . getInput ( 'token' )
19
19
const version = core . getInput ( 'version' )
20
20
21
+ const assetFullName = `${ assetName } -linux-amd64.tar.gz`
22
+
21
23
if ( version !== 'latest' && ! isSemVer ( version ) ) {
22
24
core . setFailed ( 'Invalid version' )
23
25
return
@@ -41,7 +43,7 @@ export async function run(
41
43
return
42
44
}
43
45
44
- const asset = targetRelease . assets . find ( a => a . name === assetName )
46
+ const asset = targetRelease . assets . find ( a => a . name === assetFullName )
45
47
if ( ! asset ) {
46
48
core . setFailed ( `Asset for version v${ version } not found` )
47
49
return
You can’t perform that action at this time.
0 commit comments