chore(ci,codeql): lint fixes, release trigger; stamp ?v in HTML/CSS; fix editor cache-busting
This commit is contained in:
19
.github/codeql/codeql-config.yml
vendored
19
.github/codeql/codeql-config.yml
vendored
@@ -1,15 +1,12 @@
|
|||||||
---
|
---
|
||||||
name: "FileRise CodeQL config"
|
name: "FileRise CodeQL config"
|
||||||
|
|
||||||
# Scan only FileRise code, not vendored/minified/generated assets
|
|
||||||
paths:
|
paths:
|
||||||
- public/js # frontend JS/ES modules
|
- "public/js"
|
||||||
- src
|
- "api"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- public/vendor/**
|
- "public/vendor/**"
|
||||||
- public/css/vendor/**
|
- "public/css/vendor/**"
|
||||||
- public/fonts/**
|
- "public/fonts/**"
|
||||||
- public/**/*.min.js
|
- "public/**/*.min.js"
|
||||||
- public/**/*.min.css
|
- "public/**/*.min.css"
|
||||||
- public/**/*.map
|
- "public/**/*.map"
|
||||||
- **/node_modules/**
|
|
||||||
|
|||||||
8
.github/workflows/codeql.yml
vendored
8
.github/workflows/codeql.yml
vendored
@@ -3,9 +3,9 @@ name: "CodeQL"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "master", "main" ]
|
branches: ["master", "main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "master", "main" ]
|
branches: ["master", "main"]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 6 * * 1" # Mondays 06:00 UTC
|
- cron: "0 6 * * 1" # Mondays 06:00 UTC
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: [ "javascript" ] # add more if needed: "python", "go", etc.
|
language: ["javascript"] # add more if needed: "python", "go", etc.
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -34,7 +34,5 @@ jobs:
|
|||||||
config-file: .github/codeql/codeql-config.yml
|
config-file: .github/codeql/codeql-config.yml
|
||||||
queries: +security-extended
|
queries: +security-extended
|
||||||
|
|
||||||
# - uses: github/codeql-action/autobuild@v3
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|||||||
3
.github/workflows/release-on-version.yml
vendored
3
.github/workflows/release-on-version.yml
vendored
@@ -7,6 +7,9 @@ on:
|
|||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- public/js/version.js
|
- public/js/version.js
|
||||||
|
workflow_run:
|
||||||
|
workflows: "Bump version and sync Changelog to Docker Repo"
|
||||||
|
types: completed
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
41
.github/workflows/sync-changelog.yml
vendored
41
.github/workflows/sync-changelog.yml
vendored
@@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
name: Bump version and sync Changelog to Docker Repo
|
name: Bump version and sync Changelog to Docker Repo
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'CHANGELOG.md'
|
- "CHANGELOG.md"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump_and_sync:
|
bump_and_sync:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -42,33 +42,30 @@
|
|||||||
window.APP_VERSION = '${{ steps.ver.outputs.version }}';
|
window.APP_VERSION = '${{ steps.ver.outputs.version }}';
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Stamp asset cache-busters (?v=...) and {{APP_VER}}
|
- name: Stamp asset cache-busters (?v=...) in HTML/CSS and {{APP_VER}} everywhere
|
||||||
if: steps.ver.outputs.version != ''
|
if: steps.ver.outputs.version != ''
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
VER="${{ steps.ver.outputs.version }}" # e.g. v1.6.9
|
VER="${{ steps.ver.outputs.version }}" # e.g. v1.6.9
|
||||||
QVER="${VER#v}" # e.g. 1.6.9
|
QVER="${VER#v}" # e.g. 1.6.9
|
||||||
|
echo "Stamping ?v=${QVER} and {{APP_VER}}=${VER}"
|
||||||
|
|
||||||
echo "Stamping ?v= to ${QVER} and {{APP_VER}} to ${VER}"
|
# 1) Only stamp ?v= in HTML/CSS (avoid JS concatenation issues)
|
||||||
|
mapfile -t html_css < <(git ls-files -- 'public/*.html' 'public/**/*.html' 'public/*.css' 'public/**/*.css')
|
||||||
# List candidate files under public/
|
for f in "${html_css[@]}"; do
|
||||||
mapfile -t files < <(git ls-files -- \
|
|
||||||
'public/**/*.html' \
|
|
||||||
'public/**/*.css' \
|
|
||||||
'public/**/*.js' \
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${#files[@]}" -gt 0 ]; then
|
|
||||||
for f in "${files[@]}"; do
|
|
||||||
# Replace any existing ?v=VALUE (dev, v1.2.3, 1.2.3, timestamp, etc.) with new numeric version
|
|
||||||
sed -E -i "s/(\?v=)[^\"'&<>\s]*/\1${QVER}/g" "$f"
|
sed -E -i "s/(\?v=)[^\"'&<>\s]*/\1${QVER}/g" "$f"
|
||||||
# Replace {{APP_VER}} placeholders (leave the leading v for display)
|
|
||||||
sed -E -i "s/\{\{APP_VER\}\}/${VER}/g" "$f"
|
sed -E -i "s/\{\{APP_VER\}\}/${VER}/g" "$f"
|
||||||
done
|
done
|
||||||
else
|
|
||||||
echo "No HTML/CSS/JS files found under public/ to stamp."
|
# 2) For JS, only replace the {{APP_VER}} placeholder (do NOT touch ?v=)
|
||||||
fi
|
mapfile -t jsfiles < <(git ls-files -- 'public/*.js' 'public/**/*.js')
|
||||||
|
for f in "${jsfiles[@]}"; do
|
||||||
|
sed -E -i "s/\{\{APP_VER\}\}/${VER}/g" "$f"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Changed files:"
|
||||||
|
git status --porcelain | awk '{print $2}' | sed 's/^/ - /'
|
||||||
|
|
||||||
- name: Commit version bump + stamped assets
|
- name: Commit version bump + stamped assets
|
||||||
if: steps.ver.outputs.version != ''
|
if: steps.ver.outputs.version != ''
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const MODE_LOAD_TIMEOUT_MS = 2500; // allow closing immediately; don't wait fore
|
|||||||
function loadScriptOnce(url) {
|
function loadScriptOnce(url) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const ver = (window.APP_VERSION ?? 'dev').replace(/^v/, ''); // "v1.6.9" -> "1.6.9"
|
const ver = (window.APP_VERSION ?? 'dev').replace(/^v/, ''); // "v1.6.9" -> "1.6.9"
|
||||||
const withQS = url + '?v=1.6.9' + ver;
|
const withQS = url + '?v=' + ver;
|
||||||
|
|
||||||
const key = `cm:${withQS}`;
|
const key = `cm:${withQS}`;
|
||||||
let s = document.querySelector(`script[data-key="${key}"]`);
|
let s = document.querySelector(`script[data-key="${key}"]`);
|
||||||
|
|||||||
Reference in New Issue
Block a user