Files
spark/.github/workflows/build-dist.yml
Dylan M. Taylor 9ed9d5d24b ci: lock workflow actions through an actions.lock lockfile
Mutable action tags are a supply-chain risk: a moved tag runs different code
without a diff. Every workflow action is now pinned through
.github/workflows/actions.lock, and CI verifies the lockfile so an out-of-sync
or tampered one fails instead of running.
2026-11-12 10:06:54 -05:00

59 lines
1.5 KiB
YAML

name: Build dist
on:
push:
branches:
- main
paths:
- 'src/**'
jobs:
build-dist:
runs-on: ubuntu-latest
steps:
- name: Harden runner
uses: step-security/harden-runner@v2.22.4
with:
egress-policy: audit
- name: Generate GitHub App token
id: generate-token
uses: step-security/github-app-token@v2.1.0
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4.4.0
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Set up Node.js
uses: actions/setup-node@v4.4.0
with:
node-version: '22.x'
- name: Install dependencies
run: npm install
- name: Build Dist
run: npm run build
- name: Commit and push changes
env:
TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
git config user.name "sparkjsdev[bot]"
git config user.email "123456789+sparkjsdev[bot]@users.noreply.github.com"
git add .
git commit -m "Bump dist build" || echo "No build changes"
SHA=$(git rev-parse HEAD)
echo "$SHA" > dist/commit.txt
git add dist/commit.txt
git commit -m "Update main CDN URL. (https://cdn.jsdelivr.net/gh/sparkjsdev/spark@$SHA/dist/spark.module.js)"
git push origin HEAD:main