diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c2643d3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: Node CI/CD + +on: + push: + branches: [main] + pull_request: + branches: [main] + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18, 20] # Test against multiple Node versions + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Dependencies + run: npm install + + # - name: Run Lint + # run: npm run lint + + # - name: Run Tests + # run: npm test + + publish: + needs: build + runs-on: ubuntu-latest + # if: github.event_name == 'release' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js for Publishing + uses: actions/setup-node@v3 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Install Dependencies + run: npm install + + # Uncomment if you have a build step + # - name: Build Package + # run: npm run build + + - name: Publish Package + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish