Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up downloaded assets after verification and install #193

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v3.0.1

BUG FIXES

- Remove downloaded hc-release assets after verification and install to prevent dirty workspace directory for subsequent actions

# v3.0.0

NOTES
Expand Down
4 changes: 3 additions & 1 deletion scripts/setup-hc-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ sums_name="hc-releases_${version}_SHA256SUMS"
echo "Installing release $version"

# download
/bin/rm -vf "$sums_name" "hc-releases_${version}_${pattern}" # remove in case they already exist from previous invocation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still needed unless the gh release download ... commands below get --clobber.
(When this was written, self-hosted runners had an older version of gh that didn't support --clobber and jobs that used the action twice would fail to download the second time around.)

gh release download --repo=hashicorp/releases-api "$tag" --pattern "$sums_name"
gh release download --repo=hashicorp/releases-api "$tag" --pattern "*$pattern"
# verify checksum
Expand All @@ -67,6 +66,9 @@ run_quiet unzip -o -d "$DEST_DIR" "hc-releases_${version}_$pattern"
chmod 755 "${DEST_DIR}/hc-releases"
echo "$DEST_DIR" >> "$GITHUB_PATH"

# clean up downloads
/bin/rm -vf "$sums_name" "hc-releases_${version}_${pattern}"

# report version installed
V="$("${DEST_DIR}/hc-releases" version)"
echo "version=$V" >> "$GITHUB_OUTPUT"
Expand Down