@davoodmehraban89 / Factor-easy / commits / 0650019
Fork 0

سامانه صدور فاکتور و حسابداری

ci: deploy Pages only after exact-SHA release gate

davoodmehraban89 committed Oct 2, 2026 at 01:10 UTC 06500190a7215389180dd95a8785671154655691
1 file changed +56
.github/workflows/pages.yml new
+56
@@ -0,0 +1,56 @@
1 +name: Deploy gated Pages
2 +
3 +on:
4 + workflow_run:
5 + workflows: ["Release gate"]
6 + types: [completed]
7 +
8 +permissions:
9 + contents: read
10 + pages: write
11 + id-token: write
12 + actions: read
13 +
14 +concurrency:
15 + group: pages-production
16 + cancel-in-progress: false
17 +
18 +jobs:
19 + deploy:
20 + name: Deploy exact gated SHA
21 + if: >-
22 + github.event.workflow_run.conclusion == 'success' &&
23 + github.event.workflow_run.head_branch == 'main'
24 + runs-on: ubuntu-latest
25 + environment:
26 + name: github-pages
27 + url: ${{ steps.deployment.outputs.page_url }}
28 + steps:
29 + - name: Checkout exact gated SHA
30 + uses: actions/checkout@v7
31 + with:
32 + ref: ${{ github.event.workflow_run.head_sha }}
33 + persist-credentials: false
34 + - name: Reconfirm exact release-gate job
35 + env:
36 + GH_TOKEN: ${{ github.token }}
37 + REPO: ${{ github.repository }}
38 + RUN_ID: ${{ github.event.workflow_run.id }}
39 + HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
40 + run: |
41 + set -euo pipefail
42 + run_sha="$(gh api "repos/$REPO/actions/runs/$RUN_ID" --jq '.head_sha')"
43 + test "$run_sha" = "$HEAD_SHA" || { echo '::error::Release-gate SHA mismatch'; exit 1; }
44 + conclusion="$(gh api "repos/$REPO/actions/runs/$RUN_ID/jobs?per_page=100" --jq '[.jobs[] | select(.name == "Exact SHA promotion gate")] | last | .conclusion // empty')"
45 + test "$conclusion" = success || { echo '::error::Exact SHA promotion gate is not successful'; exit 1; }
46 + - name: Build bounded hardened site
47 + run: node scripts/build-pages.mjs
48 + - name: Configure Pages
49 + uses: actions/configure-pages@v5
50 + - name: Upload Pages artifact
51 + uses: actions/upload-pages-artifact@v4
52 + with:
53 + path: _site
54 + - name: Deploy to GitHub Pages
55 + id: deployment
56 + uses: actions/deploy-pages@v4