diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ddb175..6548227 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,3 +40,10 @@ jobs: - run: rtx exec -- node --version - run: which node - run: node -v + specific_version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./ + with: + version: 2023.12.23 diff --git a/README.md b/README.md index ad5290a..830b8eb 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ jobs: - uses: actions/checkout@v3 - uses: jdx/rtx-action@v1 with: + version: 2023.12.0 # [default: latest] rtx version to install + install: true # [default: true] run `rtx install` + cache: true # [default: true] cache rtx using GitHub's cache tool_versions: | shellcheck 0.9.0 - run: shellcheck scripts/*.sh diff --git a/action.yml b/action.yml index 8d032bc..8d492ac 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,9 @@ branding: icon: arrow-down-circle color: purple inputs: + version: + required: false + description: 'The version of rtx to use. If not specified, will use the latest release.' tool_versions: required: false description: If present, this value will be written to the .tool-versions file diff --git a/dist/index.js b/dist/index.js index b90f4d0..d6c5139 100644 --- a/dist/index.js +++ b/dist/index.js @@ -82940,7 +82940,8 @@ async function run() { core.saveState('CACHE', true); core.setOutput('cache-hit', false); } - await setupRTX(); + const version = core.getInput('version'); + await setupRTX(version); await setEnvVars(); await exec.exec('rtx', ['--version']); const install = core.getBooleanInput('install', { required: false }); @@ -82972,9 +82973,11 @@ async function restoreRTXCache() { core.saveState('CACHE_KEY', cacheKey); core.info(`rtx cache restored from key: ${cacheKey}`); } -async function setupRTX() { +async function setupRTX(version) { const rtxBinDir = path.join((0, utils_1.rtxDir)(), 'bin'); - const url = `https://rtx.jdx.dev/rtx-latest-${getOS()}-${os.arch()}`; + const url = version + ? `https://rtx.jdx.dev/v${version}/rtx-v${version}-${getOS()}-${os.arch()}` + : `https://rtx.jdx.dev/rtx-latest-${getOS()}-${os.arch()}`; await fs.promises.mkdir(rtxBinDir, { recursive: true }); await exec.exec('curl', [url, '--output', path.join(rtxBinDir, 'rtx')]); await exec.exec('chmod', ['+x', path.join(rtxBinDir, 'rtx')]); diff --git a/src/main.ts b/src/main.ts index d5a6609..3cd7c97 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,7 +18,8 @@ async function run(): Promise { core.setOutput('cache-hit', false) } - await setupRTX() + const version = core.getInput('version') + await setupRTX(version) await setEnvVars() await exec.exec('rtx', ['--version']) const install = core.getBooleanInput('install', { required: false }) @@ -59,9 +60,11 @@ async function restoreRTXCache(): Promise { core.info(`rtx cache restored from key: ${cacheKey}`) } -async function setupRTX(): Promise { +async function setupRTX(version: string | undefined): Promise { const rtxBinDir = path.join(rtxDir(), 'bin') - const url = `https://rtx.jdx.dev/rtx-latest-${getOS()}-${os.arch()}` + const url = version + ? `https://rtx.jdx.dev/v${version}/rtx-v${version}-${getOS()}-${os.arch()}` + : `https://rtx.jdx.dev/rtx-latest-${getOS()}-${os.arch()}` await fs.promises.mkdir(rtxBinDir, { recursive: true }) await exec.exec('curl', [url, '--output', path.join(rtxBinDir, 'rtx')]) await exec.exec('chmod', ['+x', path.join(rtxBinDir, 'rtx')])