Pin CI actions, exclude unattended dependency runs, and isolate deployment [skip ci]

This commit is contained in:
Andras Schmelczer 2026-11-07 11:16:44 +00:00
commit 16bc79b5a1
2 changed files with 46 additions and 16 deletions

View file

@ -11,10 +11,10 @@ jobs:
runs-on: docker runs-on: docker
steps: steps:
- uses: actions/checkout@v4 - uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with: with:
node-version: '22.x' node-version: '22.x'
check-latest: true check-latest: true
@ -22,7 +22,7 @@ jobs:
# package-lock.json is gitignored, so cache the global npm download cache # package-lock.json is gitignored, so cache the global npm download cache
# keyed on package.json rather than relying on `npm ci` + a lockfile. # keyed on package.json rather than relying on `npm ci` + a lockfile.
- name: Cache npm dependencies - name: Cache npm dependencies
uses: actions/cache@v4 uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with: with:
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }}
@ -43,3 +43,4 @@ jobs:
- name: Build - name: Build
run: npm run build run: npm run build
if: ${{ github.actor != 'renovate-bot' && !startsWith(github.ref, 'refs/heads/renovate/') && !startsWith(github.head_ref, 'renovate/') }}

View file

@ -15,16 +15,16 @@ jobs:
runs-on: docker runs-on: docker
steps: steps:
- uses: actions/checkout@v4 - uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with: with:
node-version: '22.x' node-version: '22.x'
check-latest: true check-latest: true
- name: Cache npm dependencies - name: Cache npm dependencies
uses: actions/cache@v4 uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with: with:
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }}
@ -46,30 +46,33 @@ jobs:
- name: Build library and docs - name: Build library and docs
run: npm run build run: npm run build
- name: Deploy docs to pages mount - name: Upload static site artifact 1
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
uses: http://forgejo:3000/andras/ci-actions/deploy-pages@main uses: https://github.com/actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5
with: with:
source: docs name: pages-build-0
target: sdf-2d-docs path: docs
if-no-files-found: error
retention-days: 1
if: ${{ github.actor != 'renovate-bot' && !startsWith(github.ref, 'refs/heads/renovate/') && !startsWith(github.head_ref, 'renovate/') }}
publish-npm: publish-npm:
needs: build needs: build
runs-on: docker runs-on: docker
if: startsWith(github.ref, 'refs/tags/') if: ${{ github.actor != 'renovate-bot' && !startsWith(github.ref, 'refs/heads/renovate/') && !startsWith(github.head_ref, 'renovate/') && (startsWith(github.ref,
'refs/tags/')) }}
steps: steps:
- uses: actions/checkout@v4 - uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with: with:
node-version: '22.x' node-version: '22.x'
check-latest: true check-latest: true
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- name: Cache npm dependencies - name: Cache npm dependencies
uses: actions/cache@v4 uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with: with:
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }} key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }}
@ -86,3 +89,29 @@ jobs:
run: npm publish run: npm publish
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
build-pages:
name: Deploy static site artifacts
needs: build
if: ${{ github.actor != 'renovate-bot' && !startsWith(github.ref, 'refs/heads/renovate/') && !startsWith(github.head_ref, 'renovate/') && ((github.event_name
== 'push' && github.ref == 'refs/heads/main')) }}
runs-on: pages
container:
image: node:22-bookworm@sha256:63538dfe497cc29dfafdda25ada09b46db68a3f4cc205abf1f5d6bf0913f3384
volumes:
- /pages/sdf-2d-docs:/pages/sdf-2d-docs
concurrency:
group: pages-deploy-sdf-2d
cancel-in-progress: false
steps:
- name: Download static site artifact 1
uses: https://github.com/actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: pages-build-0
path: docs
- name: Deploy docs to pages mount
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: https://git.schmelczer.dev/andras/ci-actions/deploy-pages@a415e2a50992af99b7b6dd3f02cca372d87b11f6
with:
source: docs
target: sdf-2d-docs