add cleanup
This commit is contained in:
parent
97708959c7
commit
eaae361018
@ -76,7 +76,7 @@ jobs:
|
||||
chmod +x scripts/get_foundry_version.sh
|
||||
FOUNDRY_VERSION=$(bash scripts/get_foundry_version.sh --version-only)
|
||||
fi
|
||||
|
||||
|
||||
echo "FOUNDRY_VERSION=${FOUNDRY_VERSION}" >> $GITHUB_ENV
|
||||
echo "FoundryVTT version: ${FOUNDRY_VERSION}"
|
||||
|
||||
@ -97,12 +97,12 @@ jobs:
|
||||
echo "Authenticating to FoundryVTT..."
|
||||
chmod +x scripts/get_foundry_download.sh
|
||||
FOUNDRY_URL=$(bash scripts/get_foundry_download.sh --url-only --version "${FOUNDRY_VERSION}")
|
||||
|
||||
|
||||
if [[ -z "${FOUNDRY_URL}" || "${FOUNDRY_URL}" == "null" ]]; then
|
||||
echo "Error: Failed to get download URL from FoundryVTT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Mask the URL in logs (contains timed token)
|
||||
echo "::add-mask::${FOUNDRY_URL}"
|
||||
echo "FOUNDRY_URL=${FOUNDRY_URL}" >> $GITHUB_ENV
|
||||
@ -112,10 +112,10 @@ jobs:
|
||||
working-directory: ./foundryvtt_container
|
||||
run: |
|
||||
set -e
|
||||
|
||||
|
||||
SHOULD_BUILD=false
|
||||
FORCE_BUILD="${{ inputs.force_build }}"
|
||||
|
||||
|
||||
if [[ "${FORCE_BUILD}" == "true" ]]; then
|
||||
SHOULD_BUILD=true
|
||||
elif [[ "${EXISTING_VERSION}" == "none" ]]; then
|
||||
@ -125,12 +125,12 @@ jobs:
|
||||
elif [[ "${{ gitea.event_name }}" == "push" ]]; then
|
||||
SHOULD_BUILD=true
|
||||
fi
|
||||
|
||||
|
||||
if [[ "${SHOULD_BUILD}" == "true" ]]; then
|
||||
echo "Building FoundryVTT image..."
|
||||
|
||||
|
||||
IMAGE_NAME="${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}:${FOUNDRY_VERSION}"
|
||||
|
||||
|
||||
podman build \
|
||||
--platform linux/amd64 \
|
||||
--format oci \
|
||||
@ -143,13 +143,13 @@ jobs:
|
||||
-f Containerfile \
|
||||
-t "${IMAGE_NAME}" \
|
||||
.
|
||||
|
||||
|
||||
podman push "${IMAGE_NAME}"
|
||||
|
||||
|
||||
# Also tag as latest
|
||||
podman tag "${IMAGE_NAME}" "${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}:latest"
|
||||
podman push "${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}:latest"
|
||||
|
||||
|
||||
echo "BUILD_STATUS=success" >> $GITHUB_ENV
|
||||
echo "✅ Successfully built FoundryVTT ${FOUNDRY_VERSION}"
|
||||
else
|
||||
@ -172,3 +172,39 @@ jobs:
|
||||
echo " Registry: ${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}"
|
||||
echo " Tags: ${FOUNDRY_VERSION}, latest"
|
||||
echo ""
|
||||
|
||||
cleanup:
|
||||
runs-on: podman-stable
|
||||
# Make sure the build waits for us
|
||||
needs: [] # (explicitly no dependencies)
|
||||
steps:
|
||||
# 1️⃣ OPTIONAL: list what we’re about to toss
|
||||
- name: 📦 List existing artifacts (debug)
|
||||
id: list_artifacts
|
||||
uses: actions/artifact@v3
|
||||
with:
|
||||
action: list
|
||||
# Adjust the pattern to whatever you actually name your artifacts
|
||||
name: "foundryvtt-build-*"
|
||||
|
||||
# 2️⃣ THE REAL CLEANUP
|
||||
- name: 🗑️ Delete stale artifacts
|
||||
uses: actions/artifact@v3
|
||||
with:
|
||||
action: delete
|
||||
# Same pattern as above – deletes everything that matches
|
||||
name: "foundryvtt-build-*"
|
||||
# Keep the newest N artifacts (set to 0 to purge all)
|
||||
keep_latest: 2 # ← keep the two most recent builds, optional
|
||||
|
||||
# 3️⃣ Log what happened (nice for audit trails)
|
||||
- name: 📊 Report deletion outcome
|
||||
if: always()
|
||||
run: |
|
||||
echo "Deleted artifacts matching 'foundryvtt-build-*'."
|
||||
if [[ -n \"${{ steps.list_artifacts.outputs.artifacts }}\" ]]; then
|
||||
echo "Previously present artifacts:"
|
||||
echo "${{ steps.list_artifacts.outputs.artifacts }}"
|
||||
else
|
||||
echo "No artifacts were found."
|
||||
fi
|
||||
|
||||
@ -52,4 +52,4 @@ EXPOSE 30000
|
||||
LABEL org.opencontainers.image.version="${FOUNDRY_VERSION}"
|
||||
|
||||
# Use exec form for proper signal handling
|
||||
ENTRYPOINT ["/usr/bin/node", "/foundryvtt/app/resources/app/main.js", "--dataPath=/foundryvtt/data"]
|
||||
ENTRYPOINT ["/usr/bin/node", "/foundryvtt/app/main.js", "--dataPath=/foundryvtt/data"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user