-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·76 lines (75 loc) · 1.94 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
if ! command -v act &> /dev/null;then
echo "Please install act from: https://github.com/nektos/act"
exit 1
fi
if ! [ -f .secrets ];then
echo ".secrets file missing"
exit 1
fi
if ! [ -f .keyring/pubring.kbx ];then
mkdir -p .keyring
gpg --verbose --batch --gen-key <<EOF
%echo Generating a basic OpenPGP key
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: User 1
Name-Comment: User 1
Name-Email: [email protected]
Expire-Date: 0
%no-ask-passphrase
%no-protection
%pubring .keyring/pubring.kbx
%secring .keyring.trustdb.gpg
%commit
%echo done
EOF
echo -e "5\ny\n" \
| gpg \
--no-default-keyring \
--secret-keyring .keyring/trustdb.gpg \
--keyring .keyring/pubring.kbx \
--command-fd 0 \
--expert \
--edit-key [email protected] trust
fi
GPGKEY="$(gpg \
--no-default-keyring \
--secret-keyring .keyring/trustdb.gpg \
--keyring .keyring/pubring.kbx \
--list-secret-keys \
--with-colons \
2> /dev/null \
| grep '^sec:' \
| cut \
--delimiter ':' \
--fields 5)"
SSH_KEY="$(cat ~/.ssh/id_rsa)"
GPG_PRIVKEY="$(gpg \
--no-default-keyring \
--secret-keyring .keyring/trustdb.gpg \
--keyring .keyring/pubring.kbx \
--export-secret-key \
--armor \
$GPGKEY)"
if [[ "$1" == "--direct" ]];then
eval < .secrets
GPG_PRIVKEY="$GPG_PRIVKEY" GPGKEY="$GPGKEY" SSH_KEY="$SSH_KEY" python3 scripts/build.py build all
elif [[ "$1" == "--repo" ]];then
if [[ "x$2" == "x" ]];then
echo "You must specify a repo"
exit 1
fi
eval < .secrets
GPG_PRIVKEY="$GPG_PRIVKEY" GPGKEY="$GPGKEY" SSH_KEY="$SSH_KEY" python3 scripts/build.py build repo "$2"
else
GPG_PRIVKEY="$GPG_PRIVKEY" GPGKEY="$GPGKEY" SSH_KEY="$SSH_KEY" act \
-s SSH_KEY \
-s GPGKEY \
-s GPG_PRIVKEY \
--secret-file .secrets \
--privileged \
-P ubuntu-latest=catthehacker/ubuntu:full-latest
fi