diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index e0976ec3..ac3aa323 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -69,8 +69,17 @@ jobs: test -f dist/speeches/index.html test -f dist/assets/icons/familyfed-favicon.png + export DEPLOY_MANIFEST="$( + cd dist + find . -type f -print0 \ + | LC_ALL=C sort -z \ + | xargs -0 sha256sum \ + | sha256sum \ + | awk '{print $1}' + )" + export DEPLOY_COMMIT="${GITHUB_SHA:-$(git rev-parse HEAD)}" - echo "Registering Nomad deployment for $DEPLOY_COMMIT" + echo "Registering Nomad deployment for $DEPLOY_COMMIT ($DEPLOY_MANIFEST)" curl -fsS \ --connect-timeout 15 \ --max-time 60 \ @@ -82,6 +91,11 @@ jobs: | jq ' (.TaskGroups[].Tasks[].Env //= {}) | .TaskGroups[].Tasks[].Env.DEPLOY_COMMIT = env.DEPLOY_COMMIT + | ((.TaskGroups[].Tasks[] | select(.Name == "build-site") | .Config.args[]) |= + (sub("/archive/[0-9a-f]{40}\\.tar\\.gz"; + "/archive/" + env.DEPLOY_COMMIT + ".tar.gz") + | sub("test \"\\$actual_manifest\" = \"[0-9a-f]{64}\""; + "test \"$actual_manifest\" = \"" + env.DEPLOY_MANIFEST + "\""))) | (.TaskGroups[].Tasks[].Artifacts[]?.GetterSource |= if startswith("git::") and test("[?&]ref=") then sub("ref=[^&]*"; "ref=" + env.DEPLOY_COMMIT) @@ -92,18 +106,6 @@ jobs: ' \ > /tmp/familyfed-job.json - jq '.Job.TaskGroups[] | { - Name, - Tasks: [.Tasks[] | { - Name, - Driver, - Config, - EnvKeys: ((.Env // {}) | keys), - Artifacts, - VolumeMounts - }] - }' /tmp/familyfed-job.json - curl -fsS -X POST \ --connect-timeout 15 \ --max-time 60 \