Improved README and ui-asset workflow
This commit is contained in:
@@ -3,8 +3,17 @@ set -xeuo pipefail
|
||||
|
||||
# GITEA_TOKEN
|
||||
if [[ -z "${GITEA_TOKEN:-}" ]]; then
|
||||
echo "GITEA_TOKEN is not set"
|
||||
echo "Go to https://gitea.gchq.icu/user/settings/applications and generate a token"
|
||||
echo "GITEA_TOKEN is not set. Check if the secret BOT_ACCESS_TOKEN is set in the repository settings."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${BOT_NAME:-}" ]]; then
|
||||
echo "Env var BOT_NAME is not set. Use the name of the bot user here."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${GITHUB_SERVER_URL:-}" ]]; then
|
||||
echo "Env var GITHUB_SERVER_URL is not set. Please use the Gitea base URL here."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -22,11 +31,12 @@ nix build '.#ui' --out-link "$tmpdir/result"
|
||||
tar --transform 's,^\.,assets,' -czvf "$tmpdir/assets.tar.gz" -C "$tmpdir"/result/lib/node_modules/*/out .
|
||||
NAR_HASH=$(nix-prefetch-url --unpack file://<(cat "$tmpdir/assets.tar.gz"))
|
||||
|
||||
owner=ui-asset-bot
|
||||
owner=$BOT_NAME
|
||||
package_name=ui
|
||||
package_version=$NAR_HASH
|
||||
baseurl=$GITHUB_SERVER_URL
|
||||
|
||||
url="https://gitea.gchq.icu/api/packages/$owner/generic/$package_name/$package_version/assets.tar.gz"
|
||||
url="$baseurl/api/packages/$owner/generic/$package_name/$package_version/assets.tar.gz"
|
||||
set +x
|
||||
curl --upload-file "$tmpdir/assets.tar.gz" -X PUT "$url?token=$GITEA_TOKEN"
|
||||
set -x
|
||||
|
||||
Reference in New Issue
Block a user