Skip to content

Commit 032904b

Browse files
committed
ci: Add workflow to update node dist files on master
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent d584200 commit 032904b

24 files changed

Lines changed: 97 additions & 294 deletions
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check node dist files
2+
3+
on:
4+
pull_request:
5+
6+
7+
jobs:
8+
changed_files:
9+
runs-on: ubuntu-latest
10+
name: Check node dist files
11+
permissions:
12+
pull-requests: read
13+
14+
steps:
15+
- name: Get changed files
16+
id: changed-files
17+
uses: tj-actions/changed-files@v39
18+
with:
19+
files: js/**
20+
21+
- name: Run step if any file(s) in the docs folder change
22+
if: steps.changed-files.outputs.any_changed == 'true'
23+
run: |
24+
echo "One or more files in the js folder has changed. Do NOT commit files in there as they will be generated automatically once a pull request is merged"
25+
echo "List all the files that have changed: ${{ steps.changed-files.outputs.all_changed_files }}"
26+
exit 1

.github/workflows/node.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ jobs:
3737
name: node
3838
steps:
3939
- name: Checkout
40-
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
40+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
4141

4242
- name: Read package.json node and npm engines version
4343
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
4444
id: versions
4545
with:
46-
fallbackNode: '^16'
47-
fallbackNpm: '^7'
46+
fallbackNode: '^20'
47+
fallbackNpm: '^9'
4848

4949
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
50-
uses: actions/setup-node@bea5baf987ba7aa777a8a0b4ace377a21c45c381 # v3
50+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
5151
with:
5252
node-version: ${{ steps.versions.outputs.nodeVersion }}
5353

@@ -61,19 +61,8 @@ jobs:
6161
npm run stats --if-present
6262
6363
- name: Send bundle stats to RelativeCI
64-
uses: relative-ci/agent-action@12ae70ae754dd23b097fc19af712a45b8426de55 # v2
64+
uses: relative-ci/agent-action@e92b0c712e5ad0a039faf1026cbe438b8e7fed16 # v2
6565
with:
6666
webpackStatsFile: ./webpack-stats.json
6767
key: ${{ secrets.RELATIVE_CI_KEY }}
6868
token: ${{ secrets.GITHUB_TOKEN }}
69-
70-
- name: Check webpack build changes
71-
run: |
72-
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
73-
74-
- name: Show changes on failure
75-
if: failure()
76-
run: |
77-
git status
78-
git --no-pager diff
79-
exit 1 # make it red to grab attention
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Update Node dist
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
# implemented since 28, once branched off, add your stable branch here
8+
- main
9+
# - stable28
10+
11+
concurrency:
12+
group: update-node-dist-${{ github.head_ref || github.ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
update-node-dist:
17+
runs-on: ubuntu-latest
18+
environment: update-node-dist
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
23+
with:
24+
token: ${{ secrets.COMMAND_BOT_PAT }}
25+
26+
- name: Read package.json node and npm engines version
27+
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.1
28+
id: versions
29+
with:
30+
fallbackNode: '^20'
31+
fallbackNpm: '^9'
32+
33+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
34+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
35+
with:
36+
node-version: ${{ steps.versions.outputs.nodeVersion }}
37+
38+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
39+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
40+
41+
- name: Setup git
42+
run: |
43+
git config --local user.email "nextcloud-command@users.noreply.github.com"
44+
git config --local user.name "nextcloud-command"
45+
- name: Install dependencies & build
46+
env:
47+
CYPRESS_INSTALL_BINARY: 0
48+
run: |
49+
npm ci
50+
npm run build --if-present
51+
52+
- name: Check webpack build changes
53+
id: changes
54+
continue-on-error: true
55+
run: |
56+
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
57+
58+
- name: Add and commit
59+
if: steps.changes.outcome == 'failure'
60+
run: |
61+
git add --force js/
62+
git commit --signoff -m 'chore(assets): recompile assets'
63+
git push origin ${{ github.head_ref }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ cypress/snapshots/diff
3232
# RelativeCI webpack bundle stats
3333
webpack-stats.json
3434
*.orig
35+
36+
# js folder, to be updated wth --force
37+
/js

js/viewer-components.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

js/viewer-components.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

js/viewer-filerobot.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

js/viewer-filerobot.js.LICENSE.txt

Lines changed: 0 additions & 68 deletions
This file was deleted.

js/viewer-filerobot.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

js/viewer-main.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)