setup-rokit/action.yml
2024-04-02 10:02:28 +09:00

88 lines
2.2 KiB
YAML

name: setup-aftman
description: GitHub action to install and run aftman; a toolchain manager.
author: ok-nick
inputs:
version:
description: "`aftman` git tag (usually in the form vx.x.x)"
required: false
path:
description: "Path to the `aftman.toml` directory"
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 aftman
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 LPGhatguy/aftman --pattern $pattern
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
- name: Install aftman
run: |
unzip aftman*.zip
./aftman self-install
shell: bash
- name: Delete artifacts
run: |
rm aftman*.zip
if ${{ runner.os == 'Windows' }}; then
rm aftman.exe
else
rm aftman
fi
shell: bash
- name: Set environment variable
if: runner.os == 'Windows'
run: echo "$HOME/.aftman/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell
- name: Set environment variable
if: runner.os != 'Windows'
run: echo "$HOME/.aftman/bin" >> $GITHUB_PATH
shell: bash
- name: Create auth file
run: |
cat > $HOME/.aftman/auth.toml << EOF
github = "${{ inputs.token }}"
EOF
shell: bash
- name: Cache binaries
if: ${{ inputs.cache == true || inputs.cache == 'true' }}
uses: actions/cache@v4
with:
path: |
~/.aftman/bin
~/.aftman/tool-storage
key: ${{ runner.os }}-aftman-${{hashFiles(format('{0}/{1}', inputs.path, 'aftman.toml'))}}
- name: Install tools
run: |
cd ${{ inputs.path }}
aftman install --no-trust-check
shell: bash
branding:
icon: link-2
color: blue