name: Build and Publish on: [push, pull_request] jobs: build_and_publish: name: Build and Publish (on release) runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: ๐Ÿ›Ž๏ธ Checkout uses: actions/checkout@v2 - name: ๐Ÿ› ๏ธ Configure Registry uses: actions/setup-node@v2 with: node-version: '16.x' registry-url: 'https://registry.npmjs.org' - name: ๐Ÿ“ฆ Install Dependencies run: npm ci - name: ๐Ÿงพ Test run: npm test - name: ๐Ÿ”ฅ Build Package run: npm pack - name: ๐Ÿ’พ Archive Package built uses: actions/upload-artifact@v2 with: name: package path: '*.tgz' - name: ๐Ÿš€ Publish Package run: npm publish --access public if: startsWith(github.ref, 'refs/tags/v') env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}