Skip to content

Commit 2d9e018

Browse files
committed
feat: put the install dir on $GITHUB_PATH
Each `run:` step gets a fresh shell, and an Actions shell is neither a login nor an interactive one, so nothing it starts reads the startup files the installer edited. Appending the directory to the file $GITHUB_PATH points at is the mechanism the runner does honour: it prepends those entries for every later step. So `curl ... | sh` in one step and `flagsmith` in the next now works on any runner, rather than only on images that already ship ~/.local/bin on PATH. Taken from uv's Add-Ci-Path. The release smoke job drops its explicit sourcing of the env script and relies on this instead. beep boop
1 parent ff1eef9 commit 2d9e018

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,4 @@ jobs:
6363
with:
6464
persist-credentials: false
6565
- run: sh install.sh --version "$GITHUB_REF_NAME" --bin-dir "$RUNNER_TEMP/bin"
66-
- name: the env script puts it on PATH
67-
run: |
68-
. "$HOME/.local/share/flagsmith/env"
69-
flagsmith --version
66+
- run: flagsmith --version

install.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ end
166166
EOF
167167
}
168168

169+
# add_ci_path makes the CLI available to later steps of a GitHub Actions job.
170+
# GITHUB_PATH does not expand variables, so write the resolved directory.
171+
add_ci_path() {
172+
[ -n "${GITHUB_PATH:-}" ] || return 0
173+
printf '%s\n' "$INSTALL_DIR" >>"$GITHUB_PATH"
174+
say " added ${INSTALL_DIR} to \$GITHUB_PATH"
175+
}
176+
169177
# add_source_line appends to a startup file, once.
170178
add_source_line() {
171179
grep -qF "$2" "$1" && return 0
@@ -246,7 +254,10 @@ If ${VERSION} was released moments ago its archives may still be uploading — r
246254
err "${INSTALL_DIR}/${BIN_NAME} was installed but will not run — wrong platform?"
247255
say "installed ${installed} to ${INSTALL_DIR}/${BIN_NAME}"
248256

249-
[ "$NO_MODIFY_PATH" = 1 ] || modify_path
257+
if [ "$NO_MODIFY_PATH" != 1 ]; then
258+
modify_path
259+
add_ci_path
260+
fi
250261

251262
say ""
252263
if [ "$PATH_MODIFIED" = 1 ]; then

0 commit comments

Comments
 (0)