Skip to content

Commit 19fb9cb

Browse files
authored
Merge pull request #1258 from limzykenneth/fix-files-update
Temporary fix for incorrectly updated files on version update
2 parents 931f611 + 75a7905 commit 19fb9cb

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

.github/workflows/update-documentation.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010

1111
jobs:
1212
build:
13-
name: Update p5.js documentation
13+
name: Update p5.js documentation and library files
1414
runs-on: ubuntu-latest
1515

1616
steps:
@@ -20,28 +20,18 @@ jobs:
2020
uses: actions/setup-node@v1
2121
with:
2222
node-version: 12.x
23-
- name: Extract documentation from the p5.js repo
23+
- name: Extract documentation and library files from the p5.js repo
2424
run: |
2525
npm install
26-
npm run grunt update-enJSON
26+
npm run grunt update-enJSON --target="${{ steps.p5js.outputs.VERSION }}"
2727
- name: Get p5.js release info
2828
id: p5js
2929
run: |
3030
echo ::set-output name=VERSION::${P5JS_REF/refs\/tags\//}
3131
echo ::set-output name=SHA::${P5JS_SHA}
32-
- name: Get latest p5.min.js build
33-
uses: suisei-cn/actions-download-file@v1
34-
with:
35-
url: https://github.com/processing/p5.js/releases/download/${{github.event.client_payload.ref}}/p5.min.js
36-
target: src/assets/js/
37-
- name: Get latest p5.sound.min.js build
38-
uses: suisei-cn/actions-download-file@v1
39-
with:
40-
url: https://github.com/processing/p5.js/releases/download/${{github.event.client_payload.ref}}/p5.sound.min.js
41-
target: src/assets/js/
4232
- name: Commit changes
4333
uses: EndBug/add-and-commit@v4
4434
with:
45-
message: 'Update Reference files for p5.js ${{ steps.p5js.outputs.VERSION }} release (${{ steps.p5js.outputs.SHA }})'
35+
message: 'Update files for p5.js ${{ steps.p5js.outputs.VERSION }} release (${{ steps.p5js.outputs.SHA }})'
4636
env:
4737
GITHUB_TOKEN: ${{ secrets.DOCS_COMMIT_TOKEN }}

Gruntfile.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ module.exports = function(grunt) {
365365
},
366366
shell: {
367367
generate_dataJSON: {
368-
command: 'npm ci && npm run grunt yui',
368+
command: `git checkout ${grunt.option('target')} && npm ci && npm run grunt yui build`,
369369
options: {
370370
execOptions: {
371371
cwd: 'tmp/p5.js'
@@ -378,7 +378,7 @@ module.exports = function(grunt) {
378378
grunt.registerTask('update-version', function() {
379379
const done = this.async();
380380

381-
const version = require('./src/templates/pages/reference/data.json').project.version;
381+
const version = grunt.option('target').substring(1);
382382

383383
fs.readFile('./src/data/data.yml')
384384
.then(str => {
@@ -436,6 +436,14 @@ module.exports = function(grunt) {
436436
// move the data.json files from the cloned p5.js repository to the p5.js-website repository
437437
fse.moveSync(dataJSON_p5js, dataJSON_p5jswebsite, { overwrite: true });
438438
fse.moveSync(dataJSONmin_p5js, dataJSONmin_p5jswebsite, { overwrite: true });
439+
440+
const p5min_src = 'tmp/p5.js/lib/p5.min.js';
441+
const p5min_dest = 'src/assets/js/p5.min.js';
442+
const p5Soundmin_src = 'tmp/p5.js/lib/addons/p5.sound.min.js';
443+
const p5Soundmin_dest = 'src/assets/js/p5.sound.min.js';
444+
fse.moveSync(p5min_src, p5min_dest, { overwrite: true });
445+
fse.moveSync(p5Soundmin_src, p5Soundmin_dest, { overwrite: true });
446+
439447
// delete the tmp folder that contained the p5.js repository
440448
fse.removeSync('tmp/');
441449
});
@@ -451,8 +459,8 @@ module.exports = function(grunt) {
451459
'clone_p5js_repo',
452460
'generate_dataJSON',
453461
'move_dataJSON',
454-
'generate_enJSON',
455-
// 'json-to-fluent'
462+
'update-version',
463+
'generate_enJSON'
456464
]);
457465

458466
// multi-tasks: collections of other tasks
@@ -476,12 +484,11 @@ module.exports = function(grunt) {
476484

477485
// runs tasks in order
478486
grunt.registerTask('build', [
479-
'update-version',
487+
// 'update-version',
480488
'exec',
481489
'clean',
482490
'requirejs:yuidoc_theme',
483491
'requirejs',
484-
// 'fluent-to-json',
485492
'copy',
486493
'optimize',
487494
'assemble',

0 commit comments

Comments
 (0)