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:
2024-07-15 14:57:34 +01:00
- name: Install Rokit
run: |
case ${{ runner.os }} in
Linux|macOS) curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/rojo-rbx/rokit/main/scripts/install.sh | bash -s - $(echo ${{ inputs.version }} | tr -d v) ;;
Windows) gh release download ${{ inputs.version }} --repo rojo-rbx/rokit --pattern *windows-x86_64.zip ;;
esac
2022-07-18 04:55:01 +01:00
env:
GITHUB_TOKEN: ${{ inputs.token }}
2023-08-03 16:25:22 +01:00
shell: bash
2022-07-18 02:32:18 +01:00
2024-07-15 14:57:34 +01:00
- name: Add Rokit to PATH
run: echo "$HOME/.rokit/bin" >> $GITHUB_PATH
shell: bash
2022-09-17 04:17:01 +01:00
- name: Create auth file
run: |
2024-07-15 14:47:19 +01:00
cat > $HOME/.rokit/auth.toml << EOF
2022-09-22 18:22:45 +01:00
github = "${{ inputs.token }}"
2022-09-17 04:17:01 +01:00
EOF
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")
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