get chrome sign key from env

This commit is contained in:
Roy Olav Purser 2021-06-15 15:35:34 +02:00
parent 9d354c837e
commit 0a921179df
Signed by: roypur
GPG Key ID: E14D26A036F21656
2 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,9 @@ name: default
steps: steps:
- name: compile-chrome - name: compile-chrome
image: roypur/chrome-packer:latest image: roypur/chrome-packer:latest
environment:
CHROME_PRIVKEY:
from_secret: chrome_privkey
commands: commands:
- ./pack-chrome.sh - ./pack-chrome.sh
- name: gitea_release - name: gitea_release

View File

@ -5,6 +5,13 @@ temp_dir="/tmp/${temp_name}"
chrome_dir="${temp_dir}/chrome" chrome_dir="${temp_dir}/chrome"
mkdir -p "${chrome_dir}" mkdir -p "${chrome_dir}"
if [[ "${CHROME_PRIVKEY}test" == "test" ]]
then
cp "${HOME}/keys/chrome-privkey.pem" "${temp_dir}/privkey.pem"
else
echo "${CHROME_PRIVKEY}" > "${temp_dir}/privkey.pem"
fi
if [[ "${DBUS_SESSION_BUS_ADDRESS}test" == "test" ]] if [[ "${DBUS_SESSION_BUS_ADDRESS}test" == "test" ]]
then then
export DBUS_SYSTEM_BUS_ADDRESS="unix:path=${temp_dir}/dbus-system.sock" export DBUS_SYSTEM_BUS_ADDRESS="unix:path=${temp_dir}/dbus-system.sock"
@ -27,6 +34,6 @@ then
browser=$(which chromium 2> /dev/null) browser=$(which chromium 2> /dev/null)
fi fi
${browser} --disable-gpu --no-sandbox --user-data-dir=${chrome_dir} --pack-extension="${dir}/chrome" --pack-extension-key=${HOME}/keys/privkey.pem ${browser} --disable-gpu --no-sandbox --user-data-dir=${chrome_dir} --pack-extension="${dir}/chrome" --pack-extension-key="${temp_dir}/privkey.pem"
rm -rf ${temp_dir} rm -rf ${temp_dir}