93 lines
2.6 KiB
YAML
93 lines
2.6 KiB
YAML
|
name: CI
|
||
|
on:
|
||
|
push:
|
||
|
branches: [master]
|
||
|
pull_request:
|
||
|
branches: [master]
|
||
|
jobs:
|
||
|
build:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v2
|
||
|
- uses: actions/setup-node@v1
|
||
|
with:
|
||
|
node-version: 12.x
|
||
|
- run: npm ci
|
||
|
- run: npm run clean
|
||
|
- run: npm run test
|
||
|
- run: npm run package
|
||
|
- uses: actions/upload-artifact@v2
|
||
|
with:
|
||
|
name: dist
|
||
|
path: dist
|
||
|
|
||
|
test:
|
||
|
needs: [build]
|
||
|
runs-on: ubuntu-latest
|
||
|
strategy:
|
||
|
matrix:
|
||
|
target: [built, committed]
|
||
|
steps:
|
||
|
- if: github.event_name == 'push'
|
||
|
uses: actions/checkout@v2
|
||
|
- if: github.event_name == 'pull_request'
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
ref: ${{ github.head_ref }}
|
||
|
- if: matrix.target == 'built'
|
||
|
uses: actions/download-artifact@v2
|
||
|
with:
|
||
|
name: dist
|
||
|
path: dist
|
||
|
|
||
|
- name: Create change
|
||
|
run: date +%s > report.txt
|
||
|
|
||
|
- name: Create Pull Request
|
||
|
id: cpr
|
||
|
uses: ./
|
||
|
with:
|
||
|
commit-message: '[CI] test ${{ matrix.target }}'
|
||
|
committer: GitHub <noreply@github.com>
|
||
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||
|
title: '[CI] test ${{ matrix.target }}'
|
||
|
body: |
|
||
|
- CI test case for target '${{ matrix.target }}'
|
||
|
|
||
|
Auto-generated by [create-pull-request][1]
|
||
|
|
||
|
[1]: https://github.com/peter-evans/create-pull-request
|
||
|
branch: ci-test-${{ matrix.target }}
|
||
|
|
||
|
- name: Close Pull
|
||
|
uses: peter-evans/close-pull@v1
|
||
|
with:
|
||
|
pull-request-number: ${{ steps.cpr.outputs.pr_number }}
|
||
|
comment: '[CI] test ${{ matrix.target }}'
|
||
|
delete-branch: true
|
||
|
|
||
|
package:
|
||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||
|
needs: [test]
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v2
|
||
|
- uses: actions/download-artifact@v2
|
||
|
with:
|
||
|
name: dist
|
||
|
path: dist
|
||
|
- name: Create Pull Request
|
||
|
uses: peter-evans/create-pull-request@v2
|
||
|
with:
|
||
|
commit-message: Update distribution
|
||
|
committer: GitHub <noreply@github.com>
|
||
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||
|
title: Update distribution
|
||
|
body: |
|
||
|
- Updates the distribution for changes on `master`
|
||
|
|
||
|
Auto-generated by [create-pull-request][1]
|
||
|
|
||
|
[1]: https://github.com/peter-evans/create-pull-request
|
||
|
branch: update-distribution
|