|
| 1 | +name: Test & Maybe Release |
| 2 | +on: [push, pull_request] |
| 3 | +jobs: |
| 4 | + test: |
| 5 | + name: Node ${{ matrix.node }} on ${{ matrix.os }} |
| 6 | + runs-on: ${{ matrix.os }} |
| 7 | + |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + matrix: |
| 11 | + node: [12, 14, 16] |
| 12 | + # windows support not quite ready: os: [ubuntu-latest, windows-latest] |
| 13 | + os: [ubuntu-latest] |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Clone repository |
| 17 | + uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - run: git fetch --prune --unshallow |
| 20 | + |
| 21 | + - name: Set Node.js version |
| 22 | + uses: actions/setup-node@v2 |
| 23 | + with: |
| 24 | + node-version: ${{ matrix.node }} |
| 25 | + |
| 26 | + - run: node --version |
| 27 | + - run: npm --version |
| 28 | + - run: git --version |
| 29 | + |
| 30 | + - name: Install npm dependencies |
| 31 | + run: npm ci |
| 32 | + |
| 33 | + - name: Run tests |
| 34 | + run: npm test |
| 35 | + |
| 36 | + release: |
| 37 | + name: Release |
| 38 | + needs: test |
| 39 | + runs-on: ubuntu-latest |
| 40 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v2.3.4 |
| 45 | + with: |
| 46 | + fetch-depth: 0 |
| 47 | + |
| 48 | + - name: Setup Node.js |
| 49 | + uses: actions/setup-node@v2.4.0 |
| 50 | + with: |
| 51 | + node-version: 14 |
| 52 | + |
| 53 | + - name: Install dependencies |
| 54 | + run: | |
| 55 | + npm install --no-progress --no-package-lock --no-save |
| 56 | +
|
| 57 | + - name: Build |
| 58 | + run: | |
| 59 | + npm run build |
| 60 | +
|
| 61 | + - name: Install plugins |
| 62 | + run: | |
| 63 | + npm install \ |
| 64 | + @semantic-release/commit-analyzer \ |
| 65 | + conventional-changelog-conventionalcommits \ |
| 66 | + @semantic-release/release-notes-generator \ |
| 67 | + @semantic-release/npm \ |
| 68 | + @semantic-release/github \ |
| 69 | + @semantic-release/git \ |
| 70 | + @semantic-release/changelog \ |
| 71 | + --no-progress --no-package-lock --no-save |
| 72 | +
|
| 73 | + - name: Release |
| 74 | + env: |
| 75 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 77 | + run: npx semantic-release |
0 commit comments