From 8e8e7ba8d6e3685e766a70a00a949fe2bd74c443 Mon Sep 17 00:00:00 2001 From: Shinuwa Date: Fri, 23 Oct 2026 21:24:41 +0200 Subject: [PATCH] Use the runner output file for deployment workflows --- .forgejo/workflows/deploy-prod.yml | 2 +- .forgejo/workflows/validate-main.yml | 4 ++-- tests/deployment-workflow.test.mjs | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/deploy-prod.yml b/.forgejo/workflows/deploy-prod.yml index 8a8944a..5db835f 100644 --- a/.forgejo/workflows/deploy-prod.yml +++ b/.forgejo/workflows/deploy-prod.yml @@ -44,7 +44,7 @@ jobs: commit="$(git rev-parse HEAD)" printf '%s' "$commit" | grep -Eq '^[0-9a-f]{40}$' git merge-base --is-ancestor "$commit" origin/main - printf 'sha=%s\n' "$commit" >> "$GITEA_OUTPUT" + printf 'sha=%s\n' "$commit" >> "$GITHUB_OUTPUT" node --version npm --version diff --git a/.forgejo/workflows/validate-main.yml b/.forgejo/workflows/validate-main.yml index fab2dc4..edd6c45 100644 --- a/.forgejo/workflows/validate-main.yml +++ b/.forgejo/workflows/validate-main.yml @@ -36,7 +36,7 @@ jobs: run: | commit="$(git rev-parse HEAD)" test "$commit" = "$PUSHED_COMMIT" - printf 'sha=%s\n' "$commit" >> "$GITEA_OUTPUT" + printf 'sha=%s\n' "$commit" >> "$GITHUB_OUTPUT" - name: Install dependencies from the lockfile run: npm ci @@ -69,7 +69,7 @@ jobs: else printf 'Skipping stale commit %s; main is now %s.\n' "$DEPLOY_COMMIT" "$current_commit" fi - printf 'deploy=%s\n' "$deploy" >> "$GITEA_OUTPUT" + printf 'deploy=%s\n' "$deploy" >> "$GITHUB_OUTPUT" - name: Install the deployment clients if: steps.freshness.outputs.deploy == 'true' diff --git a/tests/deployment-workflow.test.mjs b/tests/deployment-workflow.test.mjs index 8386930..38146d8 100644 --- a/tests/deployment-workflow.test.mjs +++ b/tests/deployment-workflow.test.mjs @@ -24,6 +24,7 @@ test("main pushes validate then automatically deploy the same current commit", a assert.match(workflow, /npm run check:full/); assert.match(workflow, /deploy:\s+[\s\S]*needs: validate/); assert.match(workflow, /DEPLOY_COMMIT: \$\{\{ needs\.validate\.outputs\.commit \}\}/); + assert.match(workflow, />> "\$GITHUB_OUTPUT"/); assert.match(workflow, /steps\.freshness\.outputs\.deploy == 'true'/); assert.match(workflow, /current_commit[\s\S]*DEPLOY_COMMIT/); assert.match(workflow, /deploy-contract/); @@ -34,6 +35,7 @@ test("main pushes validate then automatically deploy the same current commit", a assert.doesNotMatch(workflow, /workflow_dispatch:/); assert.doesNotMatch(workflow, /StrictHostKeyChecking=no/); assert.doesNotMatch(workflow, /192\.168\.0\.100/); + assert.doesNotMatch(workflow, /GITEA_OUTPUT/); assert.doesNotMatch(validateJob, /secrets\./); assert.doesNotMatch(validateJob, /\bssh\b/); }); @@ -49,7 +51,7 @@ test("production deployment requires a validated exact commit and pinned SSH hos assert.match(workflow, /npm ci/); assert.match(workflow, /npm run check:full/); assert.match(workflow, /git merge-base --is-ancestor "\$commit" origin\/main/); - assert.match(workflow, />> "\$GITEA_OUTPUT"/); + assert.match(workflow, />> "\$GITHUB_OUTPUT"/); assert.match(workflow, /DEPLOY_COMMIT: \$\{\{ needs\.validate\.outputs\.commit \}\}/); assert.match(workflow, /deploy-contract/); assert.match(workflow, /deploy-sokko-g --commit/); @@ -58,6 +60,7 @@ test("production deployment requires a validated exact commit and pinned SSH hos assert.match(workflow, /StrictHostKeyChecking=yes/); assert.doesNotMatch(workflow, /StrictHostKeyChecking=no/); assert.doesNotMatch(workflow, /192\.168\.0\.100/); + assert.doesNotMatch(workflow, /GITEA_OUTPUT/); assert.doesNotMatch(workflow, /\$\{\{\s*forgejo\./); });