diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f1c54ff --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,41 @@ +name: NPM Publish + +env: + NODE_VERSION: 16 + +on: + push: + tags: v* + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION }} + registry-url: https://registry.npmjs.org/ + cache: npm + + - run: node --version + - run: npm --version + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + env: + NODE_ENV: production + + - name: Tests + run: npm run test + + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 40ee3f2..84dc254 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/setup-node@v2 with: - node-version: ${{env.NODE_VERSION}} + node-version: ${{ env.NODE_VERSION }} cache: npm - run: node --version