forked from apache/echarts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from apache/master
echarts MR
- Loading branch information
Showing
106 changed files
with
25,130 additions
and
19,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Deploy PR Preview | ||
|
||
on: | ||
workflow_run: | ||
workflows: ['Node CI'] | ||
types: [completed] | ||
|
||
jobs: | ||
on-success: | ||
if: ${{ github.repository_owner == 'apache' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Determine if workflow build job is successful | ||
id: check-build-success | ||
uses: actions/github-script@v6 | ||
with: | ||
result-encoding: string | ||
script: | | ||
const jobsRes = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id | ||
}); | ||
return jobsRes.data.jobs.some((job) => job.name.includes('build') && job.conclusion === 'success'); | ||
outputs: | ||
SHOULD_DEPOLY: ${{ steps.check-build-success.outputs.result }} | ||
|
||
deploy: | ||
needs: [on-success] | ||
if: ${{ needs.on-success.outputs.SHOULD_DEPOLY == 'true' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Install action dependencies | ||
run: | | ||
mkdir .actions | ||
cd .actions | ||
git clone --depth=1 https://github.com/dawidd6/action-download-artifact.git | ||
git clone --depth=1 https://github.com/actions-cool/maintain-one-comment.git | ||
- name: Fetch PR dist files | ||
uses: ./.actions/action-download-artifact | ||
with: | ||
workflow: ${{ github.event.workflow.id }} | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: pr_preview | ||
if_no_artifact_found: fail | ||
|
||
- name: Output PR metadata | ||
id: pr-metadata | ||
run: | | ||
echo "NUMBER=$(cat pr_number)" >> $GITHUB_OUTPUT | ||
echo "COMMIT_SHA=$(cat pr_commit_sha)" >> $GITHUB_OUTPUT | ||
echo "COMMIT_SHA_SHORT=$(cat pr_commit_sha | cut -c 1-7)" >> $GITHUB_OUTPUT | ||
- name: Deploy dist files | ||
env: | ||
PR_NUMBER: ${{ steps.pr-metadata.outputs.NUMBER }} | ||
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | ||
run: | | ||
export SURGE_DOMAIN=https://echarts-pr-$PR_NUMBER.surge.sh | ||
npx surge --project ./package --domain $SURGE_DOMAIN --token $SURGE_TOKEN | ||
- name: Create comment for PR preview | ||
uses: ./.actions/maintain-one-comment | ||
env: | ||
PR_NUMBER: ${{ steps.pr-metadata.outputs.NUMBER }} | ||
COMMIT_SHA_SHORT: ${{ steps.pr-metadata.outputs.COMMIT_SHA_SHORT }} | ||
with: | ||
body: | | ||
<!-- ECHARTS_PR_PREVIEW --> | ||
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-${{ env.PR_NUMBER }}@${{ env.COMMIT_SHA_SHORT }} | ||
body-include: '<!-- ECHARTS_PR_PREVIEW -->' | ||
number: ${{ env.PR_NUMBER }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Teardown PR Preview | ||
|
||
on: | ||
pull_request_target: | ||
types: [closed] | ||
|
||
jobs: | ||
teardown-pr-preview: | ||
if: ${{ github.repository_owner == 'apache' && github.event.action == 'closed' && github.event.pull_request.merged != true }} | ||
concurrency: | ||
# to cancel running `ci` workflows in current PR | ||
group: 'Node CI-${{ github.event.number }}' | ||
cancel-in-progress: true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install action dependencies | ||
run: git clone --depth=1 https://github.com/actions-cool/maintain-one-comment.git | ||
|
||
- name: Delete PR preview comment | ||
uses: ./maintain-one-comment | ||
with: | ||
body-include: '<!-- ECHARTS_PR_PREVIEW -->' | ||
delete: true | ||
number: ${{ github.event.number }} | ||
|
||
- name: Teardown closed PR preview | ||
continue-on-error: true | ||
run: | | ||
export SURGE_DOMAIN='https://echarts-pr-${{ github.event.number }}.surge.sh' | ||
npx surge teardown $SURGE_DOMAIN --token ${{ secrets.SURGE_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run lint | ||
npm run checktype |
Oops, something went wrong.