From 7998e289749d8c1893037a9611050302402fda64 Mon Sep 17 00:00:00 2001 From: Dan Manges Date: Wed, 25 Jan 2023 11:54:31 -0500 Subject: [PATCH] Make the v prefix on version numbers optional (#10) --- .github/workflows/continuous_integration.yaml | 9 +++++++++ dist/index.js | 3 +++ package.json | 2 +- src/index.ts | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous_integration.yaml b/.github/workflows/continuous_integration.yaml index 856cfa6..0067d8a 100644 --- a/.github/workflows/continuous_integration.yaml +++ b/.github/workflows/continuous_integration.yaml @@ -34,6 +34,15 @@ jobs: version: v0.8.0 - run: captain --version | grep '^v0\.8\.0$' + test_specific_version_without_v_prefix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./ + with: + version: 1.0.57 + - run: captain --version | grep '^v1\.0\.57$' + lint: name: Lint runs-on: ubuntu-latest diff --git a/dist/index.js b/dist/index.js index 1984512..46e0783 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6579,6 +6579,9 @@ function run() { } version = versions.get(version); } + if (version.match(/^[0-9]+/)) { + version = `v${version}`; + } let os = process.platform; if (os === 'win32') { os = 'windows'; diff --git a/package.json b/package.json index 87f00a1..f8185c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-captain", - "version": "1.1.3", + "version": "1.1.4", "description": "This action installs the captain CLI in Github Actions", "main": "dist/index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index b87b310..fe099c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,6 +37,9 @@ async function run() { version = versions.get(version) as string } + if (version.match(/^[0-9]+/)) { + version = `v${version}` + } let os = process.platform as string if (os === 'win32') {