Add workflow for uploading dev builds of Plotly.js #7795
Add workflow for uploading dev builds of Plotly.js #7795
Conversation
|
@camdecoster FYI there are no major changes to the contents of the |
| @@ -1,17 +1,117 @@ | |||
| name: Upload dev build from PR (placeholder, not yet implemented) | |||
There was a problem hiding this comment.
| name: Upload dev build from PR |
There was a problem hiding this comment.
Because of the (silly) way GHA woks, changing this title will break the link between this workflow file and the version on master. I'll update the title immediately before merging.
| NODE_VERSION: '18' | ||
|
|
||
| jobs: | ||
| publish-dist: |
There was a problem hiding this comment.
Let's combine these two steps in a matrix configuration. They use (mostly) the same code.
There was a problem hiding this comment.
Do you think we even need the steps for both Node versions anymore? I'd be in favor of using Node 22 only. Not sure if there's any reason to keep 18, we can discuss.
| fi | ||
|
|
||
| echo "Using SHA: $SHA" | ||
| mkdir -p "upload/pr-$PR_NUM/$SHA" |
There was a problem hiding this comment.
Should we include a metadata file that includes a timestamp inside the "pr-XXXX" folder to aid in eventually deleting old builds?
There was a problem hiding this comment.
I'm betting we can get that metadata (last added/modified) through git itself or through the filesystem, so I would say let's not add it yet, but if it turns out to be necessary we can add it. I'm looking into it now.
| - 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 |
There was a problem hiding this comment.
Do we even need these steps anymore? I migrated them over, but I don't think they're necessary.
| env: | ||
| NODE_VERSION: '18' |
There was a problem hiding this comment.
| env: | |
| NODE_VERSION: '18' |
|
|
||
| - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} |
There was a problem hiding this comment.
If you combine steps, this would become moot.
| node-version: ${{ env.NODE_VERSION }} | |
| node-version: 18 |
| runs-on: ubuntu-latest | ||
| if: | | ||
| github.event_name == 'workflow_dispatch' || | ||
| (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') |
There was a problem hiding this comment.
| (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') | |
| (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success') |
| run: cp dist/plotly.js dist/plotly.node22.js | ||
|
|
||
| # Upload library uncompressed to allow for testing in REPLs | ||
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 |
Closes #7759
upload-dev-build.ymlworkflow which uploads a development build of plotly.js every time a new commit is pushed to a PRhttps://plotly.github.io/plotly.js-dev-builds/upload/pr-{PR_NUM}/latest/plotly.min.js(for the latest commit on a PR)https://plotly.github.io/plotly.js-dev-builds/upload/pr-{PR_NUM}/{SHA}/plotly.min.js(for a specific commit SHA on a PR)*/plotly.jsand*/plot-schema.jsonalso workpublish-distjobs into a separatepublish-dist.ymlworkflow, so that theupload-dev-buildworkflow can be triggered as soon aspublish-distfinishes, without waiting for all the tests to completeSteps for testing
workflow_runtrigger always runs the version of the workflow on the default branch. This is an important security feature, but it meansworkflow_runwon't allow us to test this implementationpersistent-dev-build-url-2(this branch)7795(this PR) and Run ID25395337702(a completed run of thepublish-distworkflow for this PR)