Skip to content

Commit 43dae87

Browse files
authored
fix: verify prod deploy against workflow sha (#715)
1 parent 9220d8e commit 43dae87

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

.github/workflows/deploy-pages.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ jobs:
8484
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
8585
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
8686
VITE_MAPTILER_KEY: ${{ secrets.VITE_MAPTILER_KEY }}
87+
DEPLOY_VERIFY_COMMIT: ${{ github.sha }}
8788
run: npm run build:bundle && npm run build:verify && node "$GITHUB_WORKSPACE/scripts/deploy-pages-safe.mjs" --target prod-main

scripts/deploy-pages-safe.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ async function getGitRef(args = ["rev-parse", "--abbrev-ref", "HEAD"]) {
251251

252252
async function preflight(targetName, target) {
253253
const branch = await getGitRef();
254-
const commit = await getGitRef(["rev-parse", "--short", "HEAD"]);
254+
const commit = String(process.env.DEPLOY_VERIFY_COMMIT ?? "").trim() || (await getGitRef(["rev-parse", "--short", "HEAD"]));
255255
const pkg = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
256256
const expectedReleaseTag = `v${String(pkg.version ?? "").trim()}`;
257257
const { stdout: headTagsStdout } = await run("git", ["tag", "--points-at", "HEAD"], { capture: true });

0 commit comments

Comments
 (0)