From 986fc55dbdf019c2067ded9e189ac46e8d1e6a2d Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 21 Oct 2023 23:26:47 +0200 Subject: [PATCH 1/2] [gh-actions] Add rebuild of web UI workflow on push to web-src --- .github/workflows/build_htdocs.yml | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/build_htdocs.yml diff --git a/.github/workflows/build_htdocs.yml b/.github/workflows/build_htdocs.yml new file mode 100644 index 00000000..da921442 --- /dev/null +++ b/.github/workflows/build_htdocs.yml @@ -0,0 +1,39 @@ +name: Build htdocs + +on: + push: + branches: + - master + paths: + - 'web-src/**' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + working-directory: web-src + run: npm install + + # Build for production with minification (will update web interface + # in "../htdocs") + - name: Build htdocs + working-directory: web-src + run: npm run build + + - name: Count changed files + id: count + run: | + git add htdocs/ + git diff --numstat --staged > diffstat + test -s diffstat || { echo "Warning: Push to web-src did not change htdocs"; exit 1; } + + # The GH action email is from https://github.com/orgs/community/discussions/26560 + - name: Commit and push updated assets + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "[web] Rebuild web interface" + git push From 84042a451401921b0844db67bf2e525106ad431d Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 21 Oct 2023 23:27:47 +0200 Subject: [PATCH 2/2] [gh-actions] No compilation workflows if just docs/htdocs/web-src changed --- .github/workflows/codeql-analysis.yml | 15 ++++++++++++--- .github/workflows/macos.yml | 14 ++++++++++++-- .github/workflows/ubuntu.yml | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 10af3ba8..bbf98e16 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,10 +2,19 @@ name: "CodeQL" on: push: - branches: [master, ] + branches: + - master + paths-ignore: + - 'docs/**' + - 'htdocs/**' + - 'web-src/**' pull_request: - # The branches below must be a subset of the branches above - branches: [master] + branches: + - master + paths-ignore: + - 'docs/**' + - 'htdocs/**' + - 'web-src/**' schedule: - cron: '0 19 * * 6' diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a9cd8ec3..9d852680 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -2,9 +2,19 @@ name: MacOS on: push: - branches: [ master ] + branches: + - master + paths-ignore: + - 'docs/**' + - 'htdocs/**' + - 'web-src/**' pull_request: - branches: [ master ] + branches: + - master + paths-ignore: + - 'docs/**' + - 'htdocs/**' + - 'web-src/**' workflow_dispatch: jobs: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index f3507917..6c542634 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -2,9 +2,19 @@ name: Ubuntu on: push: - branches: [ master ] + branches: + - master + paths-ignore: + - 'docs/**' + - 'htdocs/**' + - 'web-src/**' pull_request: - branches: [ master ] + branches: + - master + paths-ignore: + - 'docs/**' + - 'htdocs/**' + - 'web-src/**' workflow_dispatch: jobs: