From 8f9ba66eae7504f2c93d618d92f823dce2045cf0 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:15:32 -0400 Subject: [PATCH 1/3] first draft of deploy-dev-build workflow --- .github/workflows/ci.yml | 1 + .github/workflows/deploy-dev-build.yml | 72 ++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/deploy-dev-build.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79a69597525..c73eabaa4dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -668,6 +668,7 @@ jobs: - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 name: Upload uncompressed plotly.js built from PR, using Node 22 with: + name: plotly.node22.js retention-days: 30 archive: false path: dist/plotly.node22.js diff --git a/.github/workflows/deploy-dev-build.yml b/.github/workflows/deploy-dev-build.yml new file mode 100644 index 00000000000..5b2ddbbc1c7 --- /dev/null +++ b/.github/workflows/deploy-dev-build.yml @@ -0,0 +1,72 @@ +name: Deploy dev build from PR + +on: + workflow_run: + workflows: ["CI"] # ci.yml + types: + - completed + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event.workflow_run.event == 'pull_request' + + steps: + - name: Download Build Artifact + id: download-artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + continue-on-error: true + with: + name: plotly.node22.js # uploaded by ci.yml > publish-dist-node-v22 + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + path: temp-dist + + - name: Check if Artifact Exists + if: steps.download-artifact.outcome != 'success' + run: | + echo "No build artifact found for this run. Skipping deployment." + exit 0 + + - name: Prepare Folder Structure + id: prepare-folder-structure + run: | + PR_NUM="${{ github.event.workflow_run.pull_requests[0].number }}" + SHA="${{ github.event.workflow_run.head_sha }}" + + mkdir -p "deploy/pr-$PR_NUM/$SHA" + mkdir -p "deploy/pr-$PR_NUM/latest" + + # Name of file must match name of file uploaded by ci.yml > publish-dist-node-v22 + cp temp-dist/plotly.node22.js "deploy/pr-$PR_NUM/$SHA/plotly.js" + cp temp-dist/plotly.node22.js "deploy/pr-$PR_NUM/latest/plotly.js" + + echo "PR_NUM=$PR_NUM" >> $GITHUB_OUTPUT + echo "SHA=$SHA" >> $GITHUB_OUTPUT + + - name: Generate GitHub App Token + id: generate-token + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 #v3.1.1 + with: + app-id: ${{ variables.DEV_DEPLOY_APP_ID }} + private-key: ${{ secrets.DEV_DEPLOY_APP_PRIVATE_KEY }} + owner: plotly + repositories: plotly.js-dev-builds + + - name: Deploy to plotly.js-dev-builds repo + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 + with: + repository-name: plotly/plotly.js-dev-builds + token: ${{ steps.generate-token.outputs.token }} # create-github-app-token action automatically outputs the token + branch: gh-pages + folder: deploy + target-folder: . + clean: false + + - name: Generate Summary + run: | + BASE="https://plotly.github.io/plotly.js-dev-builds/pr-${{ steps.prepare-folder-structure.outputs.PR_NUM }}" + echo "### PR Build Deployed" >> $GITHUB_STEP_SUMMARY + echo "Builds for PR #${{ steps.prepare-folder-structure.outputs.PR_NUM }} are available:" >> $GITHUB_STEP_SUMMARY + echo "- [Latest for PR]($BASE/latest/plotly.js)" >> $GITHUB_STEP_SUMMARY + echo "- [Immutable (this commit)]($BASE/${{ steps.prepare-folder-structure.outputs.SHA }}/plotly.js)" >> $GITHUB_STEP_SUMMARY From 55fafaeec5e4ba0dfba363995f77c0368fdbba9e Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:20:44 -0400 Subject: [PATCH 2/3] syntax --- .github/workflows/deploy-dev-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-dev-build.yml b/.github/workflows/deploy-dev-build.yml index 5b2ddbbc1c7..064e670aab2 100644 --- a/.github/workflows/deploy-dev-build.yml +++ b/.github/workflows/deploy-dev-build.yml @@ -48,7 +48,7 @@ jobs: id: generate-token uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 #v3.1.1 with: - app-id: ${{ variables.DEV_DEPLOY_APP_ID }} + app-id: ${{ vars.DEV_DEPLOY_APP_ID }} private-key: ${{ secrets.DEV_DEPLOY_APP_PRIVATE_KEY }} owner: plotly repositories: plotly.js-dev-builds From bf3cf22970be21f1078a0d8449067e6b835e6fd5 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Thu, 30 Apr 2026 17:58:48 -0400 Subject: [PATCH 3/3] separate publish-dist into separate workflow --- .github/workflows/ci.yml | 118 --------------------- .github/workflows/deploy-dev-build.yml | 4 +- .github/workflows/publish-dist.yml | 137 +++++++++++++++++++++++++ 3 files changed, 139 insertions(+), 120 deletions(-) create mode 100644 .github/workflows/publish-dist.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c73eabaa4dd..5785b12c9bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -575,124 +575,6 @@ jobs: # ============================================================ # Standalone jobs (no dependencies on install-and-cibuild) # ============================================================ - publish-dist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - with: - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'npm' - - - name: Set up build environment - run: .github/scripts/env_build.sh - - - name: Preview CHANGELOG for next release (only on master) - if: github.ref == 'refs/heads/master' - run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true - - - name: Set draft version in package.json - run: | - node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe) - - - name: View package.json diff between previous and next releases - run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true - - - name: Build dist/ - run: npm run build - - # Upload library uncompressed to allow for testing in REPLs - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 - name: Upload uncompressed plotly.js built from PR, using Node 22 - with: - retention-days: 30 - archive: false - path: dist/plotly.js - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 - name: Upload Node 18 archive of plotly.js build folder - with: - name: dist-node18 - retention-days: 7 - path: dist/ - - - name: View dist/README.md diff between previous and next releases - run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true - - - name: Preview plot-schema diff (only on master) - if: github.ref == 'refs/heads/master' - run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true - - - name: Test plot-schema.json diff - run: diff --unified --color dist/plot-schema.json test/plot-schema.json - - publish-dist-node-v22: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - with: - fetch-depth: 0 - fetch-tags: true - - - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 - with: - node-version: '22.14.0' - cache: 'npm' - - - name: Set up build environment - run: .github/scripts/env_build.sh - - - name: Preview CHANGELOG for next release (only on master) - if: github.ref == 'refs/heads/master' - run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true - - - name: Set draft version in package.json - run: | - node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe) - - - name: View package.json diff between previous and next releases - run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true - - - name: Build dist/ - run: npm run build - - # This is necessary to avoid a naming collision with the upload from the Node 18 build - - name: Copy library for upload - run: cp dist/plotly.js dist/plotly.node22.js - - # Upload library uncompressed to allow for testing in REPLs - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 - name: Upload uncompressed plotly.js built from PR, using Node 22 - with: - name: plotly.node22.js - retention-days: 30 - archive: false - path: dist/plotly.node22.js - - - name: Remove copy of library - run: rm dist/plotly.node22.js - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 - name: Upload Node 22 archive of plotly.js build folder - with: - name: dist-node22 - retention-days: 7 - path: dist/ - - - name: View dist/README.md diff between previous and next releases - run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true - - - name: Preview plot-schema diff (only on master) - if: github.ref == 'refs/heads/master' - run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true - - - name: Test plot-schema.json diff - run: diff --unified --color dist/plot-schema.json test/plot-schema.json - test-stackgl-bundle: needs: detect-changes if: >- diff --git a/.github/workflows/deploy-dev-build.yml b/.github/workflows/deploy-dev-build.yml index 064e670aab2..5d66944c328 100644 --- a/.github/workflows/deploy-dev-build.yml +++ b/.github/workflows/deploy-dev-build.yml @@ -2,7 +2,7 @@ name: Deploy dev build from PR on: workflow_run: - workflows: ["CI"] # ci.yml + workflows: ["Publish Dist"] # publish-dist.yml types: - completed @@ -17,7 +17,7 @@ jobs: uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 continue-on-error: true with: - name: plotly.node22.js # uploaded by ci.yml > publish-dist-node-v22 + name: plotly.node22.js # uploaded by publish-dist.yml > publish-dist-node-v22 run-id: ${{ github.event.workflow_run.id }} github-token: ${{ secrets.GITHUB_TOKEN }} path: temp-dist diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml new file mode 100644 index 00000000000..041eb06853b --- /dev/null +++ b/.github/workflows/publish-dist.yml @@ -0,0 +1,137 @@ +name: Publish Dist + +on: + push: + branches: [master] + pull_request: + types: + - opened + - reopened + - synchronize + workflow_dispatch: + +concurrency: + group: publish-dist-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + NODE_VERSION: '18' + +jobs: + publish-dist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + fetch-depth: 0 + fetch-tags: true + + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Set up build environment + run: .github/scripts/env_build.sh + + - name: Preview CHANGELOG for next release (only on master) + if: github.ref == 'refs/heads/master' + run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true + + - name: Set draft version in package.json + run: | + node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe) + + - name: View package.json diff between previous and next releases + run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true + + - name: Build dist/ + run: npm run build + + # Upload library uncompressed to allow for testing in REPLs + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + name: Upload uncompressed plotly.js built from PR, using Node 22 + with: + retention-days: 30 + archive: false + path: dist/plotly.js + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + name: Upload Node 18 archive of plotly.js build folder + with: + name: dist-node18 + retention-days: 7 + path: dist/ + + - name: View dist/README.md diff between previous and next releases + run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true + + - name: Preview plot-schema diff (only on master) + if: github.ref == 'refs/heads/master' + run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true + + - name: Test plot-schema.json diff + run: diff --unified --color dist/plot-schema.json test/plot-schema.json + + publish-dist-node-v22: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + fetch-depth: 0 + fetch-tags: true + + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 + with: + node-version: '22.14.0' + cache: 'npm' + + - name: Set up build environment + run: .github/scripts/env_build.sh + + - name: Preview CHANGELOG for next release (only on master) + if: github.ref == 'refs/heads/master' + run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true + + - name: Set draft version in package.json + run: | + node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe) + + - name: View package.json diff between previous and next releases + run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true + + - name: Build dist/ + run: npm run build + + # This is necessary to avoid a naming collision with the upload from the Node 18 build + - name: Copy library for upload + run: cp dist/plotly.js dist/plotly.node22.js + + # Upload library uncompressed to allow for testing in REPLs + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + name: Upload uncompressed plotly.js built from PR, using Node 22 + with: + name: plotly.node22.js + retention-days: 30 + archive: false + path: dist/plotly.node22.js + + - name: Remove copy of library + run: rm dist/plotly.node22.js + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + name: Upload Node 22 archive of plotly.js build folder + with: + name: dist-node22 + retention-days: 7 + path: dist/ + + - name: View dist/README.md diff between previous and next releases + run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true + + - name: Preview plot-schema diff (only on master) + if: github.ref == 'refs/heads/master' + run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true + + - name: Test plot-schema.json diff + run: diff --unified --color dist/plot-schema.json test/plot-schema.json