Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: use separate workflows for 'push' and 'pull_request' (#3491)
- Loading branch information
1 parent
454c31e
commit 895539c
Showing
5 changed files
with
79 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Canary Release | |
on: | ||
workflow_run: | ||
workflows: | ||
- CI | ||
- PullRequest | ||
types: | ||
- completed | ||
jobs: | ||
|
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,64 @@ | ||
name: PullRequest | ||
on: pull_request | ||
jobs: | ||
ci: | ||
uses: ./.github/workflows/ci.yml | ||
|
||
benchmark: | ||
name: Run benchmark | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Deepen cloned repo | ||
env: | ||
BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
run: 'git fetch --depth=1 origin $BASE_SHA:refs/tags/BASE' | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
cache: npm | ||
node-version-file: '.node-version' | ||
|
||
- name: Install Dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Run Benchmark | ||
run: 'npm run benchmark -- --revs HEAD BASE' | ||
|
||
diff-npm-package: | ||
name: Diff content of NPM package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Deepen cloned repo | ||
env: | ||
BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
run: 'git fetch --depth=1 origin $BASE_SHA:refs/tags/BASE' | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
cache: npm | ||
node-version-file: '.node-version' | ||
|
||
- name: Install Dependencies | ||
run: npm ci --ignore-scripts | ||
|
||
- name: Generate report | ||
run: 'node resources/diff-npm-package.js BASE HEAD' | ||
|
||
- name: Upload generated report | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: npm-dist-diff.html | ||
path: ./npm-dist-diff.html | ||
if-no-files-found: ignore |
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 |
---|---|---|
@@ -1,29 +1,26 @@ | ||
name: CD | ||
on: | ||
workflow_run: | ||
workflows: | ||
- CI | ||
types: | ||
- completed | ||
branches: | ||
- main | ||
name: Push | ||
on: push | ||
jobs: | ||
ci: | ||
uses: ./.github/workflows/ci.yml | ||
deploy-to-npm-branch: | ||
name: Deploy to `npm` branch | ||
if: github.event.workflow_run.event == 'push' | ||
needs: ci | ||
if: github.ref == 'refs/heads/main' | ||
uses: ./.github/workflows/deploy-artifact-as-branch.yml | ||
with: | ||
workflow_id: ${{github.event.workflow_run.id}} | ||
workflow_id: ${{github.run_id}} | ||
artifact_name: npmDist | ||
target_branch: npm | ||
commit_message: "Deploy ${{github.event.workflow_run.head_sha}} to 'npm' branch" | ||
|
||
deploy-to-deno-branch: | ||
name: Deploy to `deno` branch | ||
if: github.event.workflow_run.event == 'push' | ||
needs: ci | ||
if: github.ref == 'refs/heads/main' | ||
uses: ./.github/workflows/deploy-artifact-as-branch.yml | ||
with: | ||
workflow_id: ${{github.event.workflow_run.id}} | ||
workflow_id: ${{github.run_id}} | ||
artifact_name: denoDist | ||
target_branch: deno | ||
commit_message: "Deploy ${{github.event.workflow_run.head_sha}} to 'deno' branch" |