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: | case ${{ runner.os }} in Linux) pattern="*linux-x86_64.zip" ;; macOS) pattern="*macos-x86_64.zip" ;; Windows) pattern="*windows-x86_64.zip" ;; esac gh release download ${{ inputs.version }} --repo rojo-rbx/rokit --pattern $pattern env: GITHUB_TOKEN: ${{ inputs.token }} shell: bash - name: Install Rokit run: | unzip rokit*.zip ./rokit self-install shell: bash - name: Delete artifacts run: | rm rokit*.zip if ${{ runner.os == 'Windows' }}; then rm rokit.exe else rm rokit fi 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: 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