setup-rokit/action.yml

72 lines
2 KiB
YAML
Raw Normal View History

2024-07-15 14:47:19 +01:00
name: setup-rokit
description: GitHub action to install and run rokit; a toolchain manager.
2024-07-15 14:47:41 +01:00
author: CompeyDev
2022-07-18 02:32:18 +01:00
inputs:
version:
2024-07-15 14:47:19 +01:00
description: "`rokit` git tag (usually in the form vx.x.x)"
required: false
2022-07-18 03:56:05 +01:00
path:
2024-07-15 14:47:19 +01:00
description: "Path to the directory with the toolchain manifest"
2022-09-17 04:16:42 +01:00
default: "."
2022-07-18 03:56:05 +01:00
required: false
2023-08-03 16:25:22 +01:00
cache:
2023-08-04 00:59:32 +01:00
description: "Whether to enable caching"
2023-09-20 18:07:24 +01:00
default: "false"
2023-08-03 16:25:22 +01:00
required: false
2022-07-18 02:32:18 +01:00
token:
2023-08-04 00:59:32 +01:00
description: "GitHub token via `github.token`"
2022-09-17 04:16:42 +01:00
default: "${{ github.token }}"
2022-07-18 17:07:51 +01:00
required: false
2022-07-18 02:32:18 +01:00
runs:
2022-09-17 04:16:42 +01:00
using: "composite"
2022-07-18 02:32:18 +01:00
steps:
- name: Download Rokit
run: |
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/rojo-rbx/rokit/main/scripts/install.sh | bash
2022-07-18 04:55:01 +01:00
env:
GITHUB_PAT: ${{ inputs.token }}
shell: bash
2024-07-15 14:57:34 +01:00
- name: Add Rokit to PATH
2024-08-04 11:56:13 +01:00
if: runner.os != 'Windows'
2024-07-15 14:57:34 +01:00
run: echo "$HOME/.rokit/bin" >> $GITHUB_PATH
shell: bash
2024-08-04 11:56:13 +01:00
- 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 }}
2022-09-17 04:17:01 +01:00
shell: bash
- name: Discover manifest file
id: manifest
2024-07-15 15:16:20 +01:00
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"
2024-07-15 15:16:20 +01:00
echo "path=$manifest_path" >> $GITHUB_OUTPUT
shell: bash
2023-08-03 16:25:22 +01:00
- name: Cache binaries
2023-12-30 05:07:40 +00:00
if: ${{ inputs.cache == true || inputs.cache == 'true' }}
2024-04-02 02:02:28 +01:00
uses: actions/cache@v4
2023-08-03 16:25:22 +01:00
with:
2023-09-18 05:49:33 +01:00
path: |
2024-07-15 14:47:19 +01:00
~/.rokit/bin
~/.rokit/tool-storage
key: ${{ runner.os }}-rokit-${{hashFiles(steps.manifest.outputs.path)}}
2023-08-03 16:25:22 +01:00
2022-07-18 03:56:05 +01:00
- name: Install tools
run: |
cd ${{ inputs.path }}
2024-07-15 14:47:19 +01:00
rokit install --no-trust-check
2022-07-18 17:20:56 +01:00
shell: bash
2022-07-18 03:56:05 +01:00
2022-07-18 02:32:18 +01:00
branding:
2024-07-15 14:47:19 +01:00
icon: download
color: red