|
| 1 | +name: Build & Stage Artifacts |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build React bundle and stage USWDS assets |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3 |
| 18 | + with: |
| 19 | + token: ${{ secrets.GH_PAT }} |
| 20 | + persist-credentials: false |
| 21 | + |
| 22 | + - name: Set up Node |
| 23 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 24 | + with: |
| 25 | + node-version: '24' |
| 26 | + cache: 'npm' |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: npm ci |
| 30 | + |
| 31 | + - name: Assert USWDS CSS integrity |
| 32 | + run: | |
| 33 | + EXPECTED=$(awk '{print $1}' scripts/uswds-css-sha256.txt) |
| 34 | + CSS_PATH="node_modules/@uswds/uswds/dist/css/uswds.min.css" |
| 35 | + ACTUAL=$(sha256sum "$CSS_PATH" | awk '{print $1}') |
| 36 | + if [ "$ACTUAL" != "$EXPECTED" ]; then |
| 37 | + echo "SECURITY: uswds.min.css SHA-256 mismatch." |
| 38 | + echo " Expected: $EXPECTED" |
| 39 | + echo " Actual: $ACTUAL" |
| 40 | + echo "If this is an intentional USWDS upgrade, update scripts/uswds-css-sha256.txt." |
| 41 | + exit 1 |
| 42 | + fi |
| 43 | + echo "CSS integrity verified: $ACTUAL" |
| 44 | +
|
| 45 | + - name: Export Salesforce Custom Labels |
| 46 | + if: env.SFDX_AUTH_URL != '' |
| 47 | + env: |
| 48 | + SFDX_AUTH_URL: ${{ secrets.SFDX_AUTH_URL }} |
| 49 | + run: node scripts/export-salesforce-labels.mjs |
| 50 | + |
| 51 | + - name: Build all artifacts |
| 52 | + run: npm run build:all |
| 53 | + |
| 54 | + # Each design system package is responsible for verifying its own artifacts. |
| 55 | + # Add a parallel verify block here when introducing a new design system package. |
| 56 | + - name: Verify USWDS artifacts |
| 57 | + run: | |
| 58 | + test -f packages/react-uswds/main/default/staticresources/sfGpsDsUsGovReactBundle.js || \ |
| 59 | + (echo "ERROR: sfGpsDsUsGovReactBundle.js not found after build:all" && exit 1) |
| 60 | + test -f packages/react-uswds/main/default/staticresources/sfGpsDsUsGovAssets.zip || \ |
| 61 | + (echo "ERROR: sfGpsDsUsGovAssets.zip not found after build:all" && exit 1) |
| 62 | +
|
| 63 | + - name: Generate artifact checksums |
| 64 | + run: | |
| 65 | + sha256sum \ |
| 66 | + packages/react-uswds/main/default/staticresources/sfGpsDsUsGovReactBundle.js \ |
| 67 | + packages/react-uswds/main/default/staticresources/sfGpsDsUsGovAssets.zip \ |
| 68 | + > packages/react-uswds/main/default/staticresources/checksums.sha256 |
| 69 | + echo "Generated checksums:" |
| 70 | + cat packages/react-uswds/main/default/staticresources/checksums.sha256 |
| 71 | +
|
| 72 | + # USWDS-specific artifact upload. Add a parallel upload step for each additional |
| 73 | + # design system package, using a distinct artifact name (e.g. react-bundle-ukgds-${{ github.sha }}). |
| 74 | + - name: Upload React bundle artifact |
| 75 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 76 | + with: |
| 77 | + name: react-bundle-${{ github.sha }} |
| 78 | + path: | |
| 79 | + packages/react-uswds/main/default/staticresources/sfGpsDsUsGovReactBundle.js |
| 80 | + packages/react-uswds/main/default/staticresources/sfGpsDsUsGovReactBundle.resource-meta.xml |
| 81 | + packages/react-uswds/main/default/staticresources/sfGpsDsUsGovAssets.zip |
| 82 | + packages/react-uswds/main/default/staticresources/sfGpsDsUsGovAssets.resource-meta.xml |
| 83 | + packages/react-uswds/main/default/staticresources/checksums.sha256 |
| 84 | + retention-days: 30 |
0 commit comments