name: Build and Deploy on: push: branches: [ master ] tags: - '*' # This will trigger the workflow on any tag push pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest continue-on-error: false steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' # Specify your Node.js version here - name: Install Dependencies run: npm install - name: Build run: npm run build - name: Upload Docs Artifact uses: actions/upload-artifact@v3 with: name: public path: public/ - name: Upload Lib Artifact uses: actions/upload-artifact@v3 with: name: dist path: dist/ verify: runs-on: ubuntu-latest continue-on-error: false steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' # Specify your Node.js version here - name: Install Dependencies run: npm install - name: Lint run: npm run lint publish-npm: needs: [build, verify] runs-on: ubuntu-latest continue-on-error: false if: startsWith(github.ref, 'refs/tags/') # This ensures the job only runs for tag pushes steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Download Artifact uses: actions/download-artifact@v3 with: name: dist - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' # Specify your Node.js version here - name: Publish to NPM run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} deploy-docs: name: 'Deploy to Netlify' runs-on: ubuntu-latest needs: [build, verify] if: startsWith(github.ref, 'refs/tags/') # This ensures the job only runs for tag pushes steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Download Artifact uses: actions/download-artifact@v3 with: name: public - uses: jsmrcaga/action-netlify-deploy@v2.0.0 with: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} NETLIFY_DEPLOY_TO_PROD: true