| 
 | 1 | +name: Tests and publishing  | 
 | 2 | +env:  | 
 | 3 | +  FORCE_COLOR: 1  | 
 | 4 | +on:  | 
 | 5 | +  push:  | 
 | 6 | +    branches:  | 
 | 7 | +      - master  | 
 | 8 | +      - main  | 
 | 9 | +      - develop  | 
 | 10 | +  pull_request:  | 
 | 11 | +    branches:  | 
 | 12 | +      - master  | 
 | 13 | +      - main  | 
 | 14 | +jobs:  | 
 | 15 | +  test_linux:  | 
 | 16 | +    name: ${{ matrix.os }}  | 
 | 17 | +    strategy:  | 
 | 18 | +      fail-fast: false  | 
 | 19 | +      matrix:  | 
 | 20 | +        os: [ubuntu-20.04]  | 
 | 21 | +        # os: [ubuntu-18.04, ubuntu-20.04]  | 
 | 22 | +    runs-on: ${{ matrix.os }}  | 
 | 23 | +    steps:  | 
 | 24 | +      - uses: actions/checkout@v2  | 
 | 25 | +      - uses: actions/setup-node@v1  | 
 | 26 | +        with:  | 
 | 27 | +          node-version: 14  | 
 | 28 | +      - uses: microsoft/playwright-github-action@v1  | 
 | 29 | +      - uses: actions/cache@v1  | 
 | 30 | +        with:  | 
 | 31 | +          path: ~/.npm  | 
 | 32 | +          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}  | 
 | 33 | +          restore-keys: |  | 
 | 34 | +            ${{ runner.os }}-node-  | 
 | 35 | +      - name: Install dependencies  | 
 | 36 | +        run: npm ci  | 
 | 37 | +      - name: Run tests  | 
 | 38 | +        run: npm test  | 
 | 39 | +  test_win:  | 
 | 40 | +    name: "Windows"  | 
 | 41 | +    runs-on: windows-latest  | 
 | 42 | +    steps:  | 
 | 43 | +      - uses: actions/checkout@v2  | 
 | 44 | +      - uses: actions/setup-node@v1  | 
 | 45 | +        with:  | 
 | 46 | +          node-version: 14  | 
 | 47 | +      - uses: microsoft/playwright-github-action@v1  | 
 | 48 | +      - uses: actions/cache@v1  | 
 | 49 | +        with:  | 
 | 50 | +          path: ~/.npm  | 
 | 51 | +          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}  | 
 | 52 | +          restore-keys: |  | 
 | 53 | +            ${{ runner.os }}-node-  | 
 | 54 | +      - name: Install dependencies  | 
 | 55 | +        run: npm ci  | 
 | 56 | +      - name: Run tests  | 
 | 57 | +        run: npm test  | 
 | 58 | +  tag:  | 
 | 59 | +    name: "Publishing release"  | 
 | 60 | +    if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'  | 
 | 61 | +    needs:   | 
 | 62 | +      - test_linux  | 
 | 63 | +      - test_win  | 
 | 64 | +    runs-on: ubuntu-latest  | 
 | 65 | +    steps:  | 
 | 66 | +      - name: Checkout code  | 
 | 67 | +        uses: actions/checkout@v2  | 
 | 68 | +        with:  | 
 | 69 | +          fetch-depth: 0  | 
 | 70 | +      - uses: actions/setup-node@v2  | 
 | 71 | +        with:  | 
 | 72 | +          node-version: '14.x'  | 
 | 73 | +          registry-url: 'https://registry.npmjs.org'  | 
 | 74 | +      - uses: actions/cache@v1  | 
 | 75 | +        with:  | 
 | 76 | +          path: ~/.npm  | 
 | 77 | +          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}  | 
 | 78 | +          restore-keys: |  | 
 | 79 | +            ${{ runner.os }}-node-  | 
 | 80 | +      - run: npm install  | 
 | 81 | +      - name: Read version from package.json  | 
 | 82 | +        uses: culshaw/read-package-node-version-actions@v1  | 
 | 83 | +        id: package-node-version  | 
 | 84 | +      - name: Changelog  | 
 | 85 | +        uses: scottbrenner/generate-changelog-action@master  | 
 | 86 | +        id: Changelog  | 
 | 87 | +      - name: Github Release  | 
 | 88 | +        id: create_release  | 
 | 89 | +        uses: actions/create-release@latest  | 
 | 90 | +        env:  | 
 | 91 | +          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  | 
 | 92 | +        with:  | 
 | 93 | +          tag_name: v${{ steps.package-node-version.outputs.version }}  | 
 | 94 | +          release_name: v${{ steps.package-node-version.outputs.version }}  | 
 | 95 | +          body: |  | 
 | 96 | +            ${{ steps.Changelog.outputs.changelog }}  | 
 | 97 | +          draft: false  | 
 | 98 | +          prerelease: false  | 
 | 99 | +      - run: npm publish --access public  | 
 | 100 | +        env:  | 
 | 101 | +          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}  | 
0 commit comments