chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
Workflows call knotless by its grouped names
.knotless/workflows/deploy.yml+3−3
| @@ -119,7 +119,7 @@ steps: | ||
cat > /usr/local/bin/moved <<'EOF' | ||
#!/bin/sh | ||
set -o pipefail | ||
tip=$(on-host 'knotless refs "$REPO"' | awk -F '\t' -v ref="$KNOTLESS_RUN_REF" '$2 == ref { print $1 }') || exit 2 | ||
tip=$(on-host 'knotless repo refs "$REPO"' | awk -F '\t' -v ref="$KNOTLESS_RUN_REF" '$2 == ref { print $1 }') || exit 2 | ||
[ "$tip" != "$KNOTLESS_RUN_SHA" ] || exit 1 | ||
echo "$KNOTLESS_RUN_REF is at ${tip:-nothing} now, not $KNOTLESS_RUN_SHA: a newer commit will deploy" | ||
touch ~/.moved | ||
| @@ -173,7 +173,7 @@ steps: | ||
[ ! -e ~/.moved ] && [ -e ~/.up ] || exit 0 | ||
[ -n "$RELEASE_PASSWORD" ] || { echo "no RELEASE_PASSWORD: not publishing the image"; exit 0; } | ||
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) | ||
if on-host "knotless releases \"\$REPO\" knotless-server | cut -f2 | grep -qxF '$version'"; then | ||
if on-host "knotless release list \"\$REPO\" knotless-server | cut -f2 | grep -qxF '$version'"; then | ||
echo "knotless-server $version is published already" | ||
exit 0 | ||
fi | ||
| @@ -187,7 +187,7 @@ steps: | ||
set -e | ||
dir=$(mktemp -d) | ||
tar -x -C "$dir" | ||
knotless publish "$REPO" knotless-server "$VERSION" --oci "$dir" --commit "$SHA" | ||
knotless release publish "$REPO" knotless-server "$VERSION" --oci "$dir" --commit "$SHA" | ||
' | ||
- name: runner host | ||
run: | | ||
.knotless/workflows/release.yml+3−3
| @@ -31,7 +31,7 @@ steps: | ||
cp target/release/knotless /usr/local/bin/ | ||
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) | ||
echo "$version" > ~/.version | ||
if knotless releases "$REPO" knotless | cut -f2 | grep -qxF "$version"; then | ||
if knotless release list "$REPO" knotless | cut -f2 | grep -qxF "$version"; then | ||
echo "knotless $version is published already" | ||
touch ~/.done | ||
elif [ "$KNOTLESS_RUN_REF" != refs/heads/main ]; then | ||
| @@ -62,8 +62,8 @@ steps: | ||
version=$(cat ~/.version) | ||
# The version's section of the changelog, less its heading. | ||
awk -v v="$version" '/^## / { on = ($2 == v); next } on' CHANGELOG.md > ~/.notes | ||
KNOTLESS_PASSWORD="$RELEASE_PASSWORD" knotless publish "$REPO" knotless "$version" target/client/*.tar.gz --notes - < ~/.notes | ||
KNOTLESS_PASSWORD="$RELEASE_PASSWORD" knotless release publish "$REPO" knotless "$version" target/client/*.tar.gz --notes - < ~/.notes | ||
# Tagged once published, at the commit it was built from, as the | ||
# owner, so a git checkout finds the version by name. | ||
owner=${REPO#knotless://} | ||
KNOTLESS_IDENTIFIER=${owner%%/*} KNOTLESS_PASSWORD="$RELEASE_PASSWORD" knotless tag "$REPO" "v$version" "$KNOTLESS_RUN_SHA" | ||
KNOTLESS_IDENTIFIER=${owner%%/*} KNOTLESS_PASSWORD="$RELEASE_PASSWORD" knotless tag create "$REPO" "v$version" "$KNOTLESS_RUN_SHA" | ||