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 or not to enable caching" default: "true" 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 "~/.aftman/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append shell: powershell - name: Set environment variable if: runner.os != 'Windows' run: echo "~/.aftman/bin" >> $GITHUB_PATH shell: bash - name: Create auth file run: | cat > ~/.aftman/auth.toml << EOF github = "${{ inputs.token }}" EOF shell: bash - name: Cache binaries if: ${{ inputs.cache == 'true' }} uses: actions/cache@v3 with: path: ~/.aftman/bin key: ${{ runner.os }}-aftman - name: Install tools run: | cd ${{ inputs.path }} aftman install --no-trust-check shell: bash branding: icon: link-2 color: blue