Merge pull request #5 from viction-developers/workflows #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'release/*' | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build:c | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 21.x] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Run tests | ||
run: npm test | ||
- name: Build project | ||
run: yarn run build | ||
publish: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 21.x | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Build project | ||
run: npm run build | ||
- name: Publish to NPM | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npm publish |