* pinning

Fixes #205

* gh

* gh

* gh

* gh

* docs
This commit is contained in:
jdx 2023-12-14 06:39:54 -06:00 committed by GitHub
parent 0e7059cb40
commit a545a9b90a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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

9
dist/index.js generated vendored
View file

@ -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')]);

View file

@ -18,7 +18,8 @@ async function run(): Promise<void> {
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<void> {
core.info(`rtx cache restored from key: ${cacheKey}`)
}
async function setupRTX(): Promise<void> {
async function setupRTX(version: string | undefined): Promise<void> {
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')])