From d54048b8d09964c4d248ad3ff2c152a6c4ca5a2c Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 12:51:34 -0500 Subject: [PATCH 01/23] Add response_ends_trial parameter to VisualSearchCirclePlugin --- .../plugin-visual-search-circle/src/index.ts | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/packages/plugin-visual-search-circle/src/index.ts b/packages/plugin-visual-search-circle/src/index.ts index 1232970d03..0efff05000 100644 --- a/packages/plugin-visual-search-circle/src/index.ts +++ b/packages/plugin-visual-search-circle/src/index.ts @@ -89,6 +89,12 @@ const info = { pretty_name: "Fixation duration", default: 1000, }, + /** Whether a keyboard response ends the trial early */ + response_ends_trial: { + type: ParameterType.BOOL, + pretty_name: "Response ends trial", + default: true, + }, }, }; @@ -153,12 +159,21 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { }, trial.fixation_duration); }; - const end_trial = (rt: number, correct: boolean, key_press: string) => { + const response = { + rt: null, + key: null, + correct: false, + }; + + const end_trial = () => { + this.jsPsych.pluginAPI.clearAllTimeouts(); + this.jsPsych.pluginAPI.cancelAllKeyboardResponses(); + // data saving - var trial_data = { - correct: correct, - rt: rt, - response: key_press, + const trial_data = { + correct: response.correct, + rt: response.rt, + response: response.key, locations: display_locs, target_present: trial.target_present, set_size: trial.set_size, @@ -186,11 +201,7 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { "px;'>"; } - var trial_over = false; - const after_response = (info: { key: string; rt: number }) => { - trial_over = true; - var correct = false; if ( @@ -202,12 +213,16 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { correct = true; } - clear_display(); + response.rt = info.rt; + response.key = info.key; + response.correct = correct; - end_trial(info.rt, correct, info.key); + if (trial.response_ends_trial) { + end_trial(); + } }; - var valid_keys = [trial.target_present_key, trial.target_absent_key]; + const valid_keys = [trial.target_present_key, trial.target_absent_key]; const key_listener = this.jsPsych.pluginAPI.getKeyboardResponse({ callback_function: after_response, @@ -219,19 +234,11 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { if (trial.trial_duration !== null) { this.jsPsych.pluginAPI.setTimeout(() => { - if (!trial_over) { + if (!response.rt) { this.jsPsych.pluginAPI.cancelKeyboardResponse(key_listener); - - trial_over = true; - - var rt = null; - var correct = false; - var key_press = null; - - clear_display(); - - end_trial(rt, correct, key_press); } + + end_trial(); }, trial.trial_duration); } From 1c7d0af829a05f93d2e70244447eba9c2289c955 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 12:54:35 -0500 Subject: [PATCH 02/23] add test case for response_ends_trial --- .../src/index.spec.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/plugin-visual-search-circle/src/index.spec.ts b/packages/plugin-visual-search-circle/src/index.spec.ts index c2008b3388..bb69740c75 100644 --- a/packages/plugin-visual-search-circle/src/index.spec.ts +++ b/packages/plugin-visual-search-circle/src/index.spec.ts @@ -29,6 +29,36 @@ describe("visual-search-circle", () => { expect(getData().values()[0].correct).toBe(true); }); + + it("wait when response_ends_trial is false", async () => { + const { displayElement, expectFinished, expectRunning, getData } = await startTimeline([ + { + type: visualSearchCircle, + target: "target.png", + foil: "foil.png", + fixation_image: "fixation.png", + set_size: 4, + target_present: true, + target_present_key: "a", + target_absent_key: "b", + response_ends_trial: false, + trial_duration: 1500, + }, + ]); + + expect(displayElement.querySelectorAll("img").length).toBe(1); + + jest.advanceTimersByTime(1000); // fixation duration + + expect(displayElement.querySelectorAll("img").length).toBe(5); + pressKey("a"); + await expectRunning(); + + jest.runAllTimers(); + await expectFinished(); + + expect(getData().values()[0].correct).toBe(true); + }); }); describe("visual-search-circle simulation", () => { From 37430e13e9645d90e853471010bee0c95c895954 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 12:56:38 -0500 Subject: [PATCH 03/23] add changeset --- .changeset/strong-ligers-join.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-ligers-join.md diff --git a/.changeset/strong-ligers-join.md b/.changeset/strong-ligers-join.md new file mode 100644 index 0000000000..fa12b2d1c8 --- /dev/null +++ b/.changeset/strong-ligers-join.md @@ -0,0 +1,5 @@ +--- +"@jspsych/plugin-visual-search-circle": minor +--- + +Adds response_ends_trial parameter, with a default value of `true` From ba39cca0da722b55d49931e06401e83829d35dfe Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 12:56:52 -0500 Subject: [PATCH 04/23] add documentation update --- docs/plugins/visual-search-circle.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/plugins/visual-search-circle.md b/docs/plugins/visual-search-circle.md index f17c8c825e..b41ac8facb 100644 --- a/docs/plugins/visual-search-circle.md +++ b/docs/plugins/visual-search-circle.md @@ -32,6 +32,7 @@ The `target_present` and `fixation_image` parameters must always be specified. O | target_absent_key | string | 'f' | The key to press if the target is not present in the search array. | | trial_duration | numeric | null | The maximum amount of time the participant is allowed to search before the trial will continue. A value of null will allow the participant to search indefinitely. | | fixation_duration | numeric | 1000 | How long to show the fixation image for before the search array (in milliseconds). | +| response_ends_trial| boolean | true | If true, the trial will end when the participant makes a response. | ## Data Generated From e17e2fd88a34766da300ceea45441c146aef706f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Jan 2024 18:06:19 +0000 Subject: [PATCH 05/23] chore(release): version packages --- .changeset/strong-ligers-join.md | 5 ----- docs/demos/jspsych-visual-search-circle-demo1.html | 2 +- docs/demos/jspsych-visual-search-circle-demo2.html | 2 +- docs/plugins/visual-search-circle.md | 4 ++-- package-lock.json | 2 +- packages/plugin-visual-search-circle/CHANGELOG.md | 6 ++++++ packages/plugin-visual-search-circle/package.json | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 .changeset/strong-ligers-join.md diff --git a/.changeset/strong-ligers-join.md b/.changeset/strong-ligers-join.md deleted file mode 100644 index fa12b2d1c8..0000000000 --- a/.changeset/strong-ligers-join.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@jspsych/plugin-visual-search-circle": minor ---- - -Adds response_ends_trial parameter, with a default value of `true` diff --git a/docs/demos/jspsych-visual-search-circle-demo1.html b/docs/demos/jspsych-visual-search-circle-demo1.html index d4e2b1ccee..b75a92a46f 100644 --- a/docs/demos/jspsych-visual-search-circle-demo1.html +++ b/docs/demos/jspsych-visual-search-circle-demo1.html @@ -5,7 +5,7 @@ - + diff --git a/docs/demos/jspsych-visual-search-circle-demo2.html b/docs/demos/jspsych-visual-search-circle-demo2.html index b566531a9b..91adaaa57a 100644 --- a/docs/demos/jspsych-visual-search-circle-demo2.html +++ b/docs/demos/jspsych-visual-search-circle-demo2.html @@ -5,7 +5,7 @@ - + diff --git a/docs/plugins/visual-search-circle.md b/docs/plugins/visual-search-circle.md index b41ac8facb..b92a5e1a10 100644 --- a/docs/plugins/visual-search-circle.md +++ b/docs/plugins/visual-search-circle.md @@ -1,6 +1,6 @@ # visual-search-circle -Current version: 1.1.3. [See version history](https://github.com/jspsych/jsPsych/blob/main/packages/plugin-visual-search-circle/CHANGELOG.md). +Current version: 1.2.0. [See version history](https://github.com/jspsych/jsPsych/blob/main/packages/plugin-visual-search-circle/CHANGELOG.md). This plugin presents a customizable visual-search task modelled after [Wang, Cavanagh, & Green (1994)](http://dx.doi.org/10.3758/BF03206946). The participant indicates whether or not a target is present among a set of distractors. The stimuli are displayed in a circle, evenly-spaced, equidistant from a fixation point. Here is an example using normal and backward Ns: @@ -52,7 +52,7 @@ In addition to the [default data collected by all plugins](../overview/plugins.m Using the CDN-hosted JavaScript file: ```js - + ``` Using the JavaScript file downloaded from a GitHub release dist archive: diff --git a/package-lock.json b/package-lock.json index e7e175b797..56a4ca2728 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18131,7 +18131,7 @@ }, "packages/plugin-visual-search-circle": { "name": "@jspsych/plugin-visual-search-circle", - "version": "1.1.3", + "version": "1.2.0", "license": "MIT", "devDependencies": { "@jspsych/config": "^2.0.0", diff --git a/packages/plugin-visual-search-circle/CHANGELOG.md b/packages/plugin-visual-search-circle/CHANGELOG.md index 1470cc19bb..14a084e2df 100644 --- a/packages/plugin-visual-search-circle/CHANGELOG.md +++ b/packages/plugin-visual-search-circle/CHANGELOG.md @@ -1,5 +1,11 @@ # @jspsych/plugin-visual-search-circle +## 1.2.0 + +### Minor Changes + +- [#3211](https://github.com/jspsych/jsPsych/pull/3211) [`37430e13`](https://github.com/jspsych/jsPsych/commit/37430e13e9645d90e853471010bee0c95c895954) Thanks [@jodeleeuw](https://github.com/jodeleeuw)! - Adds response_ends_trial parameter, with a default value of `true` + ## 1.1.3 ### Patch Changes diff --git a/packages/plugin-visual-search-circle/package.json b/packages/plugin-visual-search-circle/package.json index cc971ef824..038e359910 100644 --- a/packages/plugin-visual-search-circle/package.json +++ b/packages/plugin-visual-search-circle/package.json @@ -1,6 +1,6 @@ { "name": "@jspsych/plugin-visual-search-circle", - "version": "1.1.3", + "version": "1.2.0", "description": "jsPsych visual search circle plugin", "type": "module", "main": "dist/index.cjs", From d2d180967a21c5064608da57d88c8c21ee6498f8 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 13:40:42 -0500 Subject: [PATCH 06/23] fix display_clear bug --- packages/plugin-visual-search-circle/src/index.spec.ts | 4 ++++ packages/plugin-visual-search-circle/src/index.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/packages/plugin-visual-search-circle/src/index.spec.ts b/packages/plugin-visual-search-circle/src/index.spec.ts index bb69740c75..bd530e49b5 100644 --- a/packages/plugin-visual-search-circle/src/index.spec.ts +++ b/packages/plugin-visual-search-circle/src/index.spec.ts @@ -27,6 +27,8 @@ describe("visual-search-circle", () => { pressKey("a"); await expectFinished(); + expect(displayElement.querySelectorAll("img").length).toBe(0); + expect(getData().values()[0].correct).toBe(true); }); @@ -57,6 +59,8 @@ describe("visual-search-circle", () => { jest.runAllTimers(); await expectFinished(); + expect(displayElement.querySelectorAll("img").length).toBe(0); + expect(getData().values()[0].correct).toBe(true); }); }); diff --git a/packages/plugin-visual-search-circle/src/index.ts b/packages/plugin-visual-search-circle/src/index.ts index 0efff05000..e329632d7a 100644 --- a/packages/plugin-visual-search-circle/src/index.ts +++ b/packages/plugin-visual-search-circle/src/index.ts @@ -166,6 +166,8 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { }; const end_trial = () => { + display_element.innerHTML = ""; + this.jsPsych.pluginAPI.clearAllTimeouts(); this.jsPsych.pluginAPI.cancelAllKeyboardResponses(); From 7b797727fa3b2b384ef964eb53d74f474ec902ef Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 13:41:22 -0500 Subject: [PATCH 07/23] add changeset --- .changeset/clever-coats-invent.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/clever-coats-invent.md diff --git a/.changeset/clever-coats-invent.md b/.changeset/clever-coats-invent.md new file mode 100644 index 0000000000..4944e78781 --- /dev/null +++ b/.changeset/clever-coats-invent.md @@ -0,0 +1,5 @@ +--- +"@jspsych/plugin-visual-search-circle": patch +--- + +Fix display clearing problem introduced with version 1.2.0 From 2feb774174a91af45cf35614d5826287dac2f8fe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 14 Jan 2024 18:51:19 +0000 Subject: [PATCH 08/23] chore(release): version packages --- .changeset/clever-coats-invent.md | 5 ----- docs/demos/jspsych-visual-search-circle-demo1.html | 2 +- docs/demos/jspsych-visual-search-circle-demo2.html | 2 +- docs/plugins/visual-search-circle.md | 4 ++-- package-lock.json | 2 +- packages/plugin-visual-search-circle/CHANGELOG.md | 6 ++++++ packages/plugin-visual-search-circle/package.json | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 .changeset/clever-coats-invent.md diff --git a/.changeset/clever-coats-invent.md b/.changeset/clever-coats-invent.md deleted file mode 100644 index 4944e78781..0000000000 --- a/.changeset/clever-coats-invent.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@jspsych/plugin-visual-search-circle": patch ---- - -Fix display clearing problem introduced with version 1.2.0 diff --git a/docs/demos/jspsych-visual-search-circle-demo1.html b/docs/demos/jspsych-visual-search-circle-demo1.html index b75a92a46f..f9efed61eb 100644 --- a/docs/demos/jspsych-visual-search-circle-demo1.html +++ b/docs/demos/jspsych-visual-search-circle-demo1.html @@ -5,7 +5,7 @@ - + diff --git a/docs/demos/jspsych-visual-search-circle-demo2.html b/docs/demos/jspsych-visual-search-circle-demo2.html index 91adaaa57a..9840d12a6d 100644 --- a/docs/demos/jspsych-visual-search-circle-demo2.html +++ b/docs/demos/jspsych-visual-search-circle-demo2.html @@ -5,7 +5,7 @@ - + diff --git a/docs/plugins/visual-search-circle.md b/docs/plugins/visual-search-circle.md index b92a5e1a10..a8c9d5a5d7 100644 --- a/docs/plugins/visual-search-circle.md +++ b/docs/plugins/visual-search-circle.md @@ -1,6 +1,6 @@ # visual-search-circle -Current version: 1.2.0. [See version history](https://github.com/jspsych/jsPsych/blob/main/packages/plugin-visual-search-circle/CHANGELOG.md). +Current version: 1.2.1. [See version history](https://github.com/jspsych/jsPsych/blob/main/packages/plugin-visual-search-circle/CHANGELOG.md). This plugin presents a customizable visual-search task modelled after [Wang, Cavanagh, & Green (1994)](http://dx.doi.org/10.3758/BF03206946). The participant indicates whether or not a target is present among a set of distractors. The stimuli are displayed in a circle, evenly-spaced, equidistant from a fixation point. Here is an example using normal and backward Ns: @@ -52,7 +52,7 @@ In addition to the [default data collected by all plugins](../overview/plugins.m Using the CDN-hosted JavaScript file: ```js - + ``` Using the JavaScript file downloaded from a GitHub release dist archive: diff --git a/package-lock.json b/package-lock.json index 56a4ca2728..bb347066d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18131,7 +18131,7 @@ }, "packages/plugin-visual-search-circle": { "name": "@jspsych/plugin-visual-search-circle", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "devDependencies": { "@jspsych/config": "^2.0.0", diff --git a/packages/plugin-visual-search-circle/CHANGELOG.md b/packages/plugin-visual-search-circle/CHANGELOG.md index 14a084e2df..6eba49b9fb 100644 --- a/packages/plugin-visual-search-circle/CHANGELOG.md +++ b/packages/plugin-visual-search-circle/CHANGELOG.md @@ -1,5 +1,11 @@ # @jspsych/plugin-visual-search-circle +## 1.2.1 + +### Patch Changes + +- [#3213](https://github.com/jspsych/jsPsych/pull/3213) [`7b797727`](https://github.com/jspsych/jsPsych/commit/7b797727fa3b2b384ef964eb53d74f474ec902ef) Thanks [@jodeleeuw](https://github.com/jodeleeuw)! - Fix display clearing problem introduced with version 1.2.0 + ## 1.2.0 ### Minor Changes diff --git a/packages/plugin-visual-search-circle/package.json b/packages/plugin-visual-search-circle/package.json index 038e359910..a99e4a29fe 100644 --- a/packages/plugin-visual-search-circle/package.json +++ b/packages/plugin-visual-search-circle/package.json @@ -1,6 +1,6 @@ { "name": "@jspsych/plugin-visual-search-circle", - "version": "1.2.0", + "version": "1.2.1", "description": "jsPsych visual search circle plugin", "type": "module", "main": "dist/index.cjs", From fffeb61a3a46d0efdb6f643e423558193816fce8 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 15:48:05 -0500 Subject: [PATCH 09/23] add publish-docs action --- .github/workflows/publish-docs.yml | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/publish-docs.yml diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 0000000000..a40b7bceff --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,49 @@ +name: Publish Docs + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install poetry using pip + run: pip install poetry + + - name: Install dependencies + run: npm ci + + - name: Get current version + id: version + run: echo "::set-output name=version::$(node -p "require('./packages/jspsych/package.json').version")" + + - name: Deploy docs + run: npm run docs:deploy ${{ steps.version.outputs.version }} + + - name: Checkout gh-docs branch + uses: actions/checkout@v2 + with: + ref: gh-docs + + - name: Push gh-docs branch + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-docs + force: true + + From e635411c705d2a15c8a77316d14c68be30541941 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 16:08:50 -0500 Subject: [PATCH 10/23] fix poetry install; remove npm ci --- .github/workflows/publish-docs.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index a40b7bceff..92c1c3a79e 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -22,14 +22,11 @@ jobs: python-version: '3.8' - name: Install poetry using pip - run: pip install poetry - - - name: Install dependencies - run: npm ci + run: pipx install poetry==1.7.0 - name: Get current version id: version - run: echo "::set-output name=version::$(node -p "require('./packages/jspsych/package.json').version")" + run: echo "::set-output name=version::$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); return `${major}.${minor}`;") - name: Deploy docs run: npm run docs:deploy ${{ steps.version.outputs.version }} From b47f142270822db483574e5ca9ab7ea33d6bd9aa Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 16:11:50 -0500 Subject: [PATCH 11/23] fix missing " mark --- .github/workflows/publish-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 92c1c3a79e..b2b7511b23 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -26,7 +26,7 @@ jobs: - name: Get current version id: version - run: echo "::set-output name=version::$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); return `${major}.${minor}`;") + run: echo "::set-output name=version::$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); return `${major}.${minor}`;")" - name: Deploy docs run: npm run docs:deploy ${{ steps.version.outputs.version }} From ab31ef6386667552af3a42d809e2a261a44661ea Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 16:18:33 -0500 Subject: [PATCH 12/23] don't try to install the root project with poetry --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8f70bf27e..cdedc57800 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "changeset": "changeset", "changeset:version": "changeset version && npm install && npm run update-unpkg-links && npm run update-plugin-versions", "changeset:publish": "npm run build && changeset publish", - "docs:deploy": "poetry install && poetry run mike deploy -u", - "docs:serve": "poetry install && poetry run mike serve" + "docs:deploy": "poetry install --no-root && poetry run mike deploy -u", + "docs:serve": "poetry install --no-root && poetry run mike serve" }, "engines": { "node": ">=18.0.0", From 09ce038f26aa8c5af064dfe4308f1eddc038362d Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 16:28:25 -0500 Subject: [PATCH 13/23] try using the environment variable --- .github/workflows/publish-docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index b2b7511b23..dc8f87d4ee 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -26,10 +26,10 @@ jobs: - name: Get current version id: version - run: echo "::set-output name=version::$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); return `${major}.${minor}`;")" + run: echo "version=$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); `${major}.${minor}`;")" >> "$GITHUB_ENV" - name: Deploy docs - run: npm run docs:deploy ${{ steps.version.outputs.version }} + run: npm run docs:deploy "$version" - name: Checkout gh-docs branch uses: actions/checkout@v2 From 9237de363a06d21663860f135d462039bea8da40 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 16:32:35 -0500 Subject: [PATCH 14/23] try using env.versions --- .github/workflows/publish-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index dc8f87d4ee..ff7c4a8c19 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -29,7 +29,7 @@ jobs: run: echo "version=$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); `${major}.${minor}`;")" >> "$GITHUB_ENV" - name: Deploy docs - run: npm run docs:deploy "$version" + run: npm run docs:deploy ${{ env.version }} - name: Checkout gh-docs branch uses: actions/checkout@v2 From 58e3df5af8d9baee5169a2de4931b8559d7fcd57 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 16:58:37 -0500 Subject: [PATCH 15/23] fix extra quotes? --- .github/workflows/publish-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index ff7c4a8c19..7f37b56b75 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -26,7 +26,7 @@ jobs: - name: Get current version id: version - run: echo "version=$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); `${major}.${minor}`;")" >> "$GITHUB_ENV" + run: echo "version=$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); `${major}.${minor}`;")" >> $GITHUB_ENV - name: Deploy docs run: npm run docs:deploy ${{ env.version }} From cca2fc445d8390746aa6302964ada991a5008893 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 17:03:10 -0500 Subject: [PATCH 16/23] repair quotes --- .github/workflows/publish-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 7f37b56b75..ff7c4a8c19 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -26,7 +26,7 @@ jobs: - name: Get current version id: version - run: echo "version=$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); `${major}.${minor}`;")" >> $GITHUB_ENV + run: echo "version=$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); `${major}.${minor}`;")" >> "$GITHUB_ENV" - name: Deploy docs run: npm run docs:deploy ${{ env.version }} From fd1c5506bff00645b424889f54bf14d4e1c101cc Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 17:03:58 -0500 Subject: [PATCH 17/23] change name --- .github/workflows/publish-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index ff7c4a8c19..e49a6d0bf8 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: jobs: - build: + deploy-docs: runs-on: ubuntu-latest steps: From a13601c3c18147515ad5c2da06241318f5f922c3 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 17:21:07 -0500 Subject: [PATCH 18/23] try simplifying --- .github/workflows/publish-docs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index e49a6d0bf8..bf7b0671ff 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -9,15 +9,15 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: '20' - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.8' @@ -26,7 +26,7 @@ jobs: - name: Get current version id: version - run: echo "version=$(node -p "const version = require('./packages/jspsych/package.json').version; const [major, minor] = version.split('.'); `${major}.${minor}`;")" >> "$GITHUB_ENV" + run: echo "version=$(node -p "require('./packages/jspsych/package.json').version")" >> "$GITHUB_ENV" - name: Deploy docs run: npm run docs:deploy ${{ env.version }} From 841d43250ce42467b4b2c1c5484ddfdacffbd0ea Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 17:27:27 -0500 Subject: [PATCH 19/23] get major.minor version another way --- .github/workflows/publish-docs.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index bf7b0671ff..f188db7873 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -28,8 +28,11 @@ jobs: id: version run: echo "version=$(node -p "require('./packages/jspsych/package.json').version")" >> "$GITHUB_ENV" + - name: Remove patch version + run: echo "version_major_minor=${{ env.version }}" | awk -F. '{print $1"."$2}' >> "$GITHUB_ENV" + - name: Deploy docs - run: npm run docs:deploy ${{ env.version }} + run: npm run docs:deploy ${{ env.version_major_minor }} - name: Checkout gh-docs branch uses: actions/checkout@v2 From 38682d86c8fdc380dc54d9cd417b0312f4f0c6f8 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 17:30:46 -0500 Subject: [PATCH 20/23] config git --- .github/workflows/publish-docs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index f188db7873..a280080306 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -31,6 +31,11 @@ jobs: - name: Remove patch version run: echo "version_major_minor=${{ env.version }}" | awk -F. '{print $1"."$2}' >> "$GITHUB_ENV" + - name: Config git + run: | + git config --global user.name docs-bot + git config --global user.email docs@jspsych.org + - name: Deploy docs run: npm run docs:deploy ${{ env.version_major_minor }} From 2faff02b1fcded888d1b175db4a5f79bea5a89aa Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 17:36:01 -0500 Subject: [PATCH 21/23] fix checkout and push --- .github/workflows/publish-docs.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index a280080306..dd12e5676b 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -39,16 +39,14 @@ jobs: - name: Deploy docs run: npm run docs:deploy ${{ env.version_major_minor }} - - name: Checkout gh-docs branch - uses: actions/checkout@v2 - with: - ref: gh-docs + - name: Switch to gh-pages branch + run: git checkout gh-pages - - name: Push gh-docs branch + - name: Push gh-pages branch uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-docs + branch: gh-pages force: true From f38673c6b8c70507f135aed7f3e4dc769c617bb1 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 17:47:17 -0500 Subject: [PATCH 22/23] DO NOT force this seems bad. --- .github/workflows/publish-docs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index dd12e5676b..5a9273f081 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -47,6 +47,5 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages - force: true From 3126fa95e31e100f1ec087c691979b6d5bd9a3f7 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Mon, 15 Jan 2024 09:24:51 -0500 Subject: [PATCH 23/23] fetch all with checkout --- .github/workflows/publish-docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 5a9273f081..291f8eca3f 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -10,6 +10,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4