From f3b69c0ba910fcc20d25f330c09bf1baae11d18b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Wed, 14 Jul 2021 10:07:51 +0000 Subject: [PATCH] automate npm publish --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++++++ .github/workflows/sample.yml | 26 ------------------------ 2 files changed, 38 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/sample.yml 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