From f67a74851e4d0a9fd78a8b0ec5b94252bdb75b7d Mon Sep 17 00:00:00 2001 From: Niloy Sikdar Date: Thu, 6 Oct 2022 13:56:38 +0530 Subject: [PATCH] ci(ci/cd): add main.yml Add main.yml GitHub Action for the CI/CD of the package Signed-off-by: Niloy Sikdar --- .github/workflows/main.yml | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4ae318e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,49 @@ +name: Check, Build & Publish Package + +on: + push: + branches: [main] + pull_request: + branches: '*' + +jobs: + check-and-build: + runs-on: ${{ matrix.os }} + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + strategy: + matrix: + node-version: [16.x] + os: [ubuntu-latest] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + - name: Install, check, test, and build using Node.js ${{ matrix.node-version }} ⚙️ + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: yarn + - run: yarn lint + - run: yarn pretty + - run: yarn build + + publish: + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/main' }} + needs: [check-and-build] + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + - name: Deploy and Publish package using Node.js ${{ matrix.node-version }} 🚀 + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: yarn + - run: yarn build + - run: yarn release