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 |
| 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.
| echo "No build artifact found for $RUN_ID. Skipping upload." | ||
| exit 0 | ||
|
|
||
| - name: Setup metadata and prepare folders |
There was a problem hiding this comment.
Should this and all subsequent steps get skipped if the download artifact step fails?
| echo "### PR Build Uploaded" >> $GITHUB_STEP_SUMMARY | ||
| echo "Builds for PR #${{ steps.setup-metadata.outputs.PR_NUM }} are available:" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Latest build for this PR: [$BASE/latest/plotly.min.js]($BASE/latest/plotly.min.js)" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Build for this commit (permalink): [$BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js]($BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js)" >> $GITHUB_STEP_SUMMARY |
There was a problem hiding this comment.
I think we'll be deleting these after a while, so let's not use the word "permalink".
| echo "- Build for this commit (permalink): [$BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js]($BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js)" >> $GITHUB_STEP_SUMMARY | |
| echo "- Build for this commit: [$BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js]($BASE/${{ steps.setup-metadata.outputs.SHA }}/plotly.min.js)" >> $GITHUB_STEP_SUMMARY |
| 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?
| - 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') |
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)