setup-rokit/action.yml

68 lines
1.8 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: Install Rokit
run: |
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/rojo-rbx/rokit/main/scripts/install.sh | sh
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
- name: Add Rokit to PATH
run: echo "$HOME/.rokit/bin" >> $GITHUB_PATH
shell: bash
- name: Create auth file
run: |
cat > $HOME/.rokit/auth.toml << EOF
github = "${{ inputs.token }}"
EOF
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")
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