|
| 1 | +name: Main |
| 2 | +on: push |
| 3 | + |
| 4 | +# TODO - Need to not repeat the checkout and setup node steps... |
| 5 | + |
| 6 | +jobs: |
| 7 | + # Set the job key. The key is displayed as the job name |
| 8 | + # when a job name is not provided |
| 9 | + lint: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: 🛑 Cancel Previous Runs |
| 13 | + uses: styfle/cancel-workflow-action@0.6.0 |
| 14 | + with: |
| 15 | + access_token: ${{ secrets.GITHUB_TOKEN }} |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + - name: Setup Node.js |
| 21 | + uses: actions/setup-node@v2 |
| 22 | + with: |
| 23 | + node-version: 12 |
| 24 | + - uses: actions/checkout@v2 |
| 25 | + - name: Install dependencies |
| 26 | + run: npm i |
| 27 | + - name: Check Security |
| 28 | + run: npm audit |
| 29 | + - uses: goto-bus-stop/standard-action@v1 |
| 30 | + with: |
| 31 | + # optionally select a different, standard-like linter |
| 32 | + # linter: semistandard |
| 33 | + |
| 34 | + # optionally select a different eslint formatter for the log output, default 'stylish' |
| 35 | + # formatter: tap |
| 36 | + |
| 37 | + # limit the files to lint, default '**/*.js' |
| 38 | + # files: src/*.js |
| 39 | + |
| 40 | + # show errors in the the github diff UI |
| 41 | + annotate: true |
| 42 | + |
| 43 | + # Allow the action to add lint errors to the github diff UI |
| 44 | + env: |
| 45 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 46 | + test: |
| 47 | + name: Test Node v${{ matrix.node }} |
| 48 | + runs-on: ubuntu-18.04 |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + node: [ '10', '12', '14' ] |
| 52 | + steps: |
| 53 | + - name: 🛑 Cancel Previous Runs |
| 54 | + uses: styfle/cancel-workflow-action@0.6.0 |
| 55 | + with: |
| 56 | + access_token: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v2 |
| 59 | + with: |
| 60 | + fetch-depth: 0 |
| 61 | + - name: Setup Node.js |
| 62 | + uses: actions/setup-node@v2 |
| 63 | + with: |
| 64 | + node-version: ${{ matrix.node }} |
| 65 | + - name: Install dependencies |
| 66 | + run: npm i |
| 67 | + - name: Test |
| 68 | + run: npm t |
| 69 | + release: |
| 70 | + name: Release |
| 71 | + runs-on: ubuntu-18.04 |
| 72 | + needs: [ |
| 73 | + test, |
| 74 | + lint |
| 75 | + ] |
| 76 | + steps: |
| 77 | + - name: 🛑 Cancel Previous Runs |
| 78 | + uses: styfle/cancel-workflow-action@0.6.0 |
| 79 | + with: |
| 80 | + access_token: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@v2 |
| 83 | + with: |
| 84 | + fetch-depth: 0 |
| 85 | + - name: Setup Node.js |
| 86 | + uses: actions/setup-node@v2 |
| 87 | + with: |
| 88 | + node-version: 12 |
| 89 | + - name: Build |
| 90 | + run: npm i |
| 91 | + - name: 🚀 Release |
| 92 | + uses: cycjimmy/semantic-release-action@v2 |
| 93 | + with: |
| 94 | + semantic_version: 17 |
| 95 | + branches: | |
| 96 | + [ |
| 97 | + 'master' |
| 98 | + ] |
| 99 | + env: |
| 100 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 101 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments