|
| 1 | +name: Test & Maybe Release |
| 2 | +on: [push, pull_request] |
| 3 | +jobs: |
| 4 | + test: |
| 5 | + strategy: |
| 6 | + fail-fast: false |
| 7 | + matrix: |
| 8 | + node: [16.x, 18.x, lts/*, current] |
| 9 | + os: [macos-latest, ubuntu-latest, windows-latest] |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + steps: |
| 12 | + - name: Checkout Repository |
| 13 | + uses: actions/checkout@v3 |
| 14 | + - name: Use Node.js ${{ matrix.node }} |
| 15 | + uses: actions/setup-node@v3.5.1 |
| 16 | + with: |
| 17 | + node-version: ${{ matrix.node }} |
| 18 | + - name: Install Dependencies |
| 19 | + run: | |
| 20 | + npm install --no-progress |
| 21 | + - name: Run tests |
| 22 | + run: | |
| 23 | + npm config set script-shell bash |
| 24 | + npm run test:ci |
| 25 | + release: |
| 26 | + name: Release |
| 27 | + needs: test |
| 28 | + runs-on: ubuntu-latest |
| 29 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 30 | + steps: |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v3 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + - name: Setup Node.js |
| 36 | + uses: actions/setup-node@v3.5.1 |
| 37 | + with: |
| 38 | + node-version: lts/* |
| 39 | + - name: Install dependencies |
| 40 | + run: | |
| 41 | + npm install --no-progress --no-package-lock --no-save |
| 42 | + - name: Build |
| 43 | + run: | |
| 44 | + npm run build |
| 45 | + - name: Install plugins |
| 46 | + run: | |
| 47 | + npm install \ |
| 48 | + @semantic-release/commit-analyzer \ |
| 49 | + conventional-changelog-conventionalcommits \ |
| 50 | + @semantic-release/release-notes-generator \ |
| 51 | + @semantic-release/npm \ |
| 52 | + @semantic-release/github \ |
| 53 | + @semantic-release/git \ |
| 54 | + @semantic-release/changelog \ |
| 55 | + --no-progress --no-package-lock --no-save |
| 56 | + - name: Release |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 60 | + run: npx semantic-release |
| 61 | + |
0 commit comments