-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add install action to install all trunk tools in trunk.yaml (#234)
install will pull trunk launcher from cloud into tmp location and then run the `trunk tools install` command. Optionally installs that are specified - else installs everything. Example of using it in flaky factory https://github.com/trunk-io/flake-factory/blob/main/.github/workflows/factory.yaml - name: trunk install uses: 54ccfcf
- Loading branch information
1 parent
4feb07f
commit 540e7fe
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Trunk Check | ||
author: trunk.io | ||
description: Install trunk and managed tools to PATH | ||
|
||
inputs: | ||
tools: | ||
description: specific tools to install (if not specified will install all enabled tools) | ||
required: false | ||
|
||
branding: | ||
icon: check | ||
color: green | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: get trunk | ||
shell: bash | ||
run: ${GITHUB_ACTION_PATH}/get_trunk.sh | ||
|
||
- name: clean up possible dead symlink | ||
shell: bash | ||
run: | | ||
tools_path=".trunk/tools" | ||
if [ -L "${tools_path}" ] && [ ! -e "${tools_path}" ] ; then | ||
rm "${tools_path}" | ||
fi | ||
- name: Trunk install | ||
shell: bash | ||
run: trunk tools install --ci ${{ inputs.tools }} | ||
|
||
- name: Add .trunk/tools to path | ||
shell: bash | ||
run: echo ".trunk/tools" >> $GITHUB_PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [[ ${INPUT_DEBUG:-false} == "true" ]]; then | ||
set -x | ||
fi | ||
|
||
tmpdir="$(mktemp -d)" | ||
echo "TRUNK_TMPDIR=${tmpdir}" >>"${GITHUB_ENV}" | ||
|
||
curl -fsSL https://trunk.io/releases/trunk -o "${tmpdir}/trunk" | ||
chmod u+x "${tmpdir}/trunk" | ||
trunk_path="${tmpdir}/trunk" | ||
|
||
echo "TRUNK_PATH=${trunk_path}" >>"${GITHUB_ENV}" | ||
echo "${tmpdir}" >>"${GITHUB_PATH}" | ||
|
||
# Ensure that trunk CLI is downloaded before subsequent steps (swallow output of version command) | ||
(${trunk_path} version >/dev/null 2>&1) || echo "::warning::${trunk_path} does not exist!" |