chore: fix npm publishing #159
This file contains hidden or 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
| # GitHub Actions docs | |
| # https://help.github.com/en/articles/about-github-actions | |
| # https://help.github.com/en/articles/workflow-syntax-for-github-actions | |
| name: CI | |
| on: [push] | |
| permissions: | |
| contents: read # for checkout | |
| jobs: | |
| build: | |
| # Machine environment: | |
| # https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions#ubuntu-1804-lts | |
| # We specify the Node.js version manually below, and use versioned Chrome from Puppeteer. | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write # to be able to publish a GitHub release | |
| issues: write # to be able to comment on released issues | |
| pull-requests: write # to be able to comment on released pull requests | |
| id-token: write # to enable use of OIDC for trusted publishing and npm provenance | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.11.x | |
| - name: Install dependencies | |
| run: yarn --frozen-lockfile --non-interactive --no-progress | |
| - name: Lint Demo | |
| run: yarn demo:lint:check | |
| - name: Format check | |
| run: yarn prettier:check | |
| - name: Check Readme | |
| run: yarn readme:check | |
| - name: Test | |
| run: yarn lib:test:ci | |
| - name: Build Lib | |
| run: yarn lib:build:prod | |
| - name: Copy built README & LICENCE into dist | |
| run: cp README.md LICENSE dist/ngx-sub-form | |
| - name: Build Demo | |
| run: yarn run demo:build:prod --progress=false --base-href "https://cloudnc.github.io/ngx-sub-form/" | |
| - name: Cypress run | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| browser: chrome | |
| start: yarn start-e2e-file-server | |
| wait-on: http://localhost:4765/ | |
| wait-on-timeout: 500 | |
| - name: Deploy | |
| if: contains('refs/heads/master', github.ref) | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./dist/ngx-sub-form-demo | |
| - name: Release | |
| if: contains('refs/heads/master refs/heads/next refs/heads/feat-upgrade-angular-15', github.ref) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx semantic-release |