Skip to content

Commit

Permalink
gh-actions/gcp/setup: Add key copy (#2465)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <[email protected]>
  • Loading branch information
phlax authored Nov 22, 2024
1 parent 2e95eb4 commit 7102200
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gh-actions/gcp/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ inputs:
boto-rm:
type: boolean
default: false
key-copy:
type: string
default:

outputs:
key-path:
value: ${{ steps.key.outputs.path }}
key-copy-path:
value: ${{ steps.key.outputs.copy-path }}


runs:
Expand Down Expand Up @@ -60,6 +65,11 @@ runs:
echo "${{ inputs.key }}" | base64 --decode > "${GCP_KEY_PATH}"
echo "path=${GCP_KEY_PATH}" >> $GITHUB_OUTPUT
echo "GCP_KEY_PATH=${GCP_KEY_PATH}" >> $GITHUB_ENV
if [[ ${{ inputs.key-copy }} == "true" ]]; then
cp -a "$GCP_KEY_PATH" "${{ inputs.key-copy }}"
echo "GCP_KEY_COPY_PATH=${GCP_KEY_COPY_PATH}" >> $GITHUB_ENV
echo "copy-path=${GCP_KEY_COPY_PATH}" >> $GITHUB_OUTPUT
fi
if [[ ${{ inputs.boto }} != "true" ]]; then
exit 0
fi
Expand All @@ -72,6 +82,10 @@ runs:
echo "Remove key ${GCP_KEY_PATH}"
rm -rf "${GCP_KEY_PATH}"
fi
if [[ -n "${GCP_KEY_COPY_PATH}" && -e "${GCP_KEY_COPY_PATH}" ]]; then
echo "Remove key ${GCP_KEY_COPY_PATH}"
rm -rf "${GCP_KEY_COPY_PATH}"
fi
if [[ -e "~/.boto" ]]; then
echo "Remove boto config ~/.boto"
rm ~/.boto
Expand Down

0 comments on commit 7102200

Please sign in to comment.