diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..1fff668c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI +on: push + +jobs: + build: + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + - run: yarn + - run: yarn + working-directory: ./sample + - name: Run tests + uses: GabrielBB/xvfb-action@v1.0 + with: + run: yarn --cwd ./sample test + + publish: + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: "https://registry.npmjs.org" + - run: yarn + - run: yarn + working-directory: ./sample + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/sample.yml b/.github/workflows/sample.yml deleted file mode 100644 index ec89f25a..00000000 --- a/.github/workflows/sample.yml +++ /dev/null @@ -1,26 +0,0 @@ -on: [push] - -name: Tests - -jobs: - build: - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install Node.js - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: Install root project dependencies - run: yarn - - name: Install sample project dependencies - run: yarn - working-directory: ./sample - - name: Run tests - uses: GabrielBB/xvfb-action@v1.0 - with: - run: yarn --cwd ./sample test