Files
pulumi-incus/inkjet.md

104 lines
3.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# pulumi-incus
## nodejs
```bash
sops exec-env secrets.sops.env 'earthly --secret TOKEN=$TOKEN --push -i +nodejs'
```
## provider
```bash
sops exec-env secrets.sops.env 'earthly --secret TOKEN=$TOKEN --push -i +provider'
```
## publish (version)
> publish the provider to gitea host. Include version number without v prefix
```bash
#=====================================================================
# upload_tarballs
#
# Upload every *.tar.gz file that contains a given version string from
# ./bin/ to a Gitea genericpackage repository.
#
# Authentication is taken from the default ~/.netrc file (via --netrc).
#
# Call signature (simplified):
# upload_tarballs <USER/PACKAGE> <VERSION>
#
# <USER/PACKAGE> username and package in the form "user/pkg"
# <VERSION> version string to match (required)
#
# Host resolution:
# * If $GITEA_HOST is set, it is used.
# * Otherwise the builtin default https://gitea.example.com is used.
#
# Example:
# export GITEA_HOST="https://gitea.example.com"
# upload_tarballs alice/my_pkg 2.5.0
#=====================================================================
upload_tarballs() {
# -----------------------------------------------------------------
# 1⃣ Argument handling and defaults
# -----------------------------------------------------------------
local user_pkg="${1:?Missing <USER/PACKAGE> argument}"
local version="${2:?Missing <VERSION> argument}"
# Extract username & genericpackage from the "user/pkg" argument
if [[ "$user_pkg" != */* ]]; then
echo "ERROR: <USER/PACKAGE> must be in the form 'username/package'" >&2
return 1
fi
local username="${user_pkg%%/*}"
local package="${user_pkg##*/}"
# Sanity checks
[[ -n "$username" && -n "$package" ]] || {
echo "ERROR: Could not parse username or package from '$user_pkg'" >&2
return 1
}
# -----------------------------------------------------------------
# 2⃣ Find matching tarballs and upload them
# -----------------------------------------------------------------
local files_found=0
# The whileloop runs in the current shell (process substitution) so
# the counter is visible after the loop finishes.
while IFS= read -r -d '' file; do
files_found=$((files_found + 1))
local filename
filename="$(basename "$file")"
# Build the Gitea API URL:
# https://HOST/api/packages/USERNAME/generic/PACKAGE/VERSION/FILE
local url="https://git.kalinow.ski/api/packages/${username}/generic/${package}/${version}/${filename}"
echo "Uploading $url"
curl --silent --show-error --fail --netrc --upload-file "$file" "$url"
local rc=$?
if (( rc != 0 )); then
echo "❌ Upload failed for $file (curl exit code $rc)" >&2
else
echo "✅ Uploaded $filename"
fi
done < <(find ./bin -type f -name "*${version}*.tar.gz" -print0)
# -----------------------------------------------------------------
# 4⃣ Final report
# -----------------------------------------------------------------
if (( files_found == 0 )); then
echo "⚠️ No *.tar.gz files containing version '${version}' were found in ./bin/."
return 1
else
echo "✅ Done $files_found file(s) processed."
fi
}
upload_tarballs kiterun/pulumi-incus $version
```