Merge pull request #609 from mayraamaral/v4 #188
This file contains hidden or 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
| name: Test & Deploy | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: current | |
| - uses: actions/checkout@v4 | |
| - run: npm audit --omit=dev | |
| test: | |
| needs: [ audit ] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [ '14', '16', '18' ] | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - uses: actions/checkout@v4 | |
| - run: npm ci | |
| - name: Test | |
| run: npm test | |
| - uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: cypress-screenshots-nodejs-${{ matrix.node-version }} | |
| path: cypress/screenshots | |
| retention-days: 7 | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: cypress-videos-nodejs-${{ matrix.node-version }} | |
| path: cypress/videos | |
| retention-days: 7 | |
| deploy: | |
| needs: [ test ] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: current | |
| - uses: actions/checkout@v4 | |
| - run: npm ci | |
| - name: Deploy @latest version to npm | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: JS-DevTools/npm-publish@v1 | |
| with: | |
| token: ${{ secrets.NPM_TOKEN }} | |
| - name: Update @next version | |
| if: startsWith(github.ref, 'refs/heads/') | |
| run: npm version prerelease --no-git-tag-version --preid "$GITHUB_RUN_NUMBER" | |
| - name: Deploy @next version to npm | |
| if: startsWith(github.ref, 'refs/heads/') | |
| uses: JS-DevTools/npm-publish@v1 | |
| with: | |
| tag: next | |
| token: ${{ secrets.NPM_TOKEN }} | |
| check-version: false |