Skip to content

Commit

Permalink
Merge branch 'master' into deploy-cue
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman authored Jan 26, 2024
2 parents f38d465 + 42bc1bd commit 75dbde9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
4 changes: 4 additions & 0 deletions actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Install
description: Installs the Catalyst-CI CLI
inputs:
asset:
description: Which asset to install from the Catalyst-CI repository
required: false
default: cli
token:
description: Github token used to query API for available CLI releases
required: false
Expand Down
5 changes: 3 additions & 2 deletions actions/install/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13719,7 +13719,6 @@ var github = __nccwpck_require__(5438);



const assetName = 'cli-linux-amd64.tar.gz';
const repoOwner = 'input-output-hk';
const repoName = 'catalyst-ci';
async function run(platform = process.platform) {
Expand All @@ -13728,8 +13727,10 @@ async function run(platform = process.platform) {
return;
}
try {
const assetName = core.getInput('asset');
const token = core.getInput('token');
const version = core.getInput('version');
const assetFullName = `${assetName}-linux-amd64.tar.gz`;
if (version !== 'latest' && !isSemVer(version)) {
core.setFailed('Invalid version');
return;
Expand All @@ -13750,7 +13751,7 @@ async function run(platform = process.platform) {
core.setFailed(`Version ${version} not found`);
return;
}
const asset = targetRelease.assets.find(a => a.name === assetName);
const asset = targetRelease.assets.find(a => a.name === assetFullName);
if (!asset) {
core.setFailed(`Asset for version v${version} not found`);
return;
Expand Down
8 changes: 7 additions & 1 deletion actions/install/src/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ describe('Setup Action', () => {
beforeAll(() => {
getInputMock.mockImplementation((name: string) => {
switch (name) {
case 'asset':
return 'cli'
case 'token':
return token
case 'version':
Expand All @@ -71,6 +73,8 @@ describe('Setup Action', () => {
beforeAll(() => {
getInputMock.mockImplementation((name: string) => {
switch (name) {
case 'asset':
return 'cli'
case 'token':
return token
case 'version':
Expand Down Expand Up @@ -103,7 +107,7 @@ describe('Setup Action', () => {
})

describe('when the version exists', () => {
describe('when the assets is not found', () => {
describe('when the asset is not found', () => {
beforeAll(() => {
getOctokitMock.mockReturnValue({
rest: {
Expand Down Expand Up @@ -199,6 +203,8 @@ describe('Setup Action', () => {
beforeAll(() => {
getInputMock.mockImplementation((name: string) => {
switch (name) {
case 'asset':
return 'cli'
case 'token':
return token
case 'version':
Expand Down
6 changes: 4 additions & 2 deletions actions/install/src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as core from '@actions/core'
import * as tc from '@actions/tool-cache'
import * as github from '@actions/github'

const assetName = 'cli-linux-amd64.tar.gz'
const repoOwner = 'input-output-hk'
const repoName = 'catalyst-ci'

Expand All @@ -15,9 +14,12 @@ export async function run(
}

try {
const assetName = core.getInput('asset')
const token = core.getInput('token')
const version = core.getInput('version')

const assetFullName = `${assetName}-linux-amd64.tar.gz`

if (version !== 'latest' && !isSemVer(version)) {
core.setFailed('Invalid version')
return
Expand All @@ -41,7 +43,7 @@ export async function run(
return
}

const asset = targetRelease.assets.find(a => a.name === assetName)
const asset = targetRelease.assets.find(a => a.name === assetFullName)
if (!asset) {
core.setFailed(`Asset for version v${version} not found`)
return
Expand Down

0 comments on commit 75dbde9

Please sign in to comment.