mirror of
https://github.com/GAM-team/GAM.git
synced 2025-05-12 04:07:21 +00:00
[no ci] update secret decode tool
This commit is contained in:
parent
7cfa8836f8
commit
6b5e19b1de
35
.github/actions/decrypt.sh
vendored
35
.github/actions/decrypt.sh
vendored
@ -1,38 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
credspath="$3"
|
credspath="$1"
|
||||||
if [ ! -d "$credspath" ]; then
|
if [ ! -d "$credspath" ]; then
|
||||||
echo "creating ${credspath}"
|
echo "creating ${credspath}"
|
||||||
mkdir -p "$credspath"
|
mkdir -p "$credspath"
|
||||||
fi
|
fi
|
||||||
gpgfile="$1"
|
|
||||||
if [ -f "$gpgfile" ]; then
|
|
||||||
echo "source file is ${gpgfile}"
|
|
||||||
else
|
|
||||||
echo "ERROR: ${gpgfile} does not exist"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
credsfile="$2"
|
|
||||||
echo "target file is ${credsfile}"
|
|
||||||
if [ -z ${PASSCODE+x} ]; then
|
|
||||||
echo "ERROR: PASSCODE is unset";
|
|
||||||
exit 2
|
|
||||||
else
|
|
||||||
echo "PASSCODE is set";
|
|
||||||
fi
|
|
||||||
|
|
||||||
gpg --batch \
|
secretvar="GAM_GHA_${JID}"
|
||||||
--yes \
|
secretval="${!secretvar}"
|
||||||
--decrypt \
|
|
||||||
--passphrase="$PASSCODE" \
|
|
||||||
--output "$credsfile" \
|
|
||||||
"$gpgfile"
|
|
||||||
|
|
||||||
if [[ "$RUNNER_OS" == "macOS" ]]; then
|
echo -e "$secretval" > "${credspath}/oauth2.txt"
|
||||||
tar="gtar"
|
|
||||||
else
|
|
||||||
tar="tar"
|
|
||||||
fi
|
|
||||||
|
|
||||||
"$tar" xlvvf "$credsfile" --directory "$credspath"
|
|
||||||
rm -rvf "$gpgfile"
|
|
||||||
rm -rvf "$credsfile"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user