setup-rokit/action.yml

71 lines
2 KiB
YAML

name: setup-rokit
description: GitHub action to install and run rokit; a toolchain manager.
author: CompeyDev
inputs:
version:
description: "`rokit` git tag (usually in the form vx.x.x)"
required: false
path:
description: "Path to the directory with the toolchain manifest"
default: "."
required: false
cache:
description: "Whether to enable caching"
default: "false"
required: false
token:
description: "GitHub token via `github.token`"
default: "${{ github.token }}"
required: false
runs:
using: "composite"
steps:
- name: Download Rokit
run: |
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/rojo-rbx/rokit/main/scripts/install.sh | bash
env:
GITHUB_PAT: ${{ inputs.token }}
shell: bash
- name: Add Rokit to PATH
if: runner.os != 'Windows'
run: echo "$HOME/.rokit/bin" >> $GITHUB_PATH
shell: bash
- name: Add Rokit to PATH
if: runner.os == 'Windows'
run: echo "$HOME/.rokit/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell
- name: Authenticate
run: rokit authenticate github --token ${{ inputs.token }}
shell: bash
- name: Discover manifest file
id: manifest
run: |
manifest_path=$(find ${{ inputs.path }} -maxdepth 1 -name "rokit.toml" -o -name "aftman.toml" -o -name "foreman.toml" | head -n 1)
echo "::debug::Discovered manifest path: $manifest_path"
echo "path=$manifest_path" >> $GITHUB_OUTPUT
shell: bash
- name: Cache binaries
if: ${{ inputs.cache == true || inputs.cache == 'true' }}
uses: actions/cache@v4
with:
path: |
~/.rokit/bin
~/.rokit/tool-storage
key: ${{ runner.os }}-rokit-${{hashFiles(steps.manifest.outputs.path)}}
- name: Install tools
run: |
cd ${{ inputs.path }}
rokit install --no-trust-check
shell: bash
branding:
icon: download
color: red