Update package publishing and readme #19
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
| name: Build and Deploy | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: https://registry.npmjs.org/ | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build library | |
| run: npm run build:lib | |
| - name: Build demo app | |
| run: npm run build | |
| - name: Build demo app for GitHub Pages | |
| run: npm run build:gh-pages | |
| deploy-pages: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build demo app for GitHub Pages | |
| run: npm run build:gh-pages | |
| - name: Deploy to GitHub Pages | |
| uses: JamesIves/github-pages-deploy-action@v4.4.3 | |
| with: | |
| branch: gh-pages | |
| folder: dist/angular-datepicker | |
| clean: true | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| # Запускаем только для главной ветки и пропускаем коммиты от semantic-release | |
| if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'chore(release):') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Используем персональный токен для возможности создания коммитов | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: https://registry.npmjs.org/ | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build library | |
| run: npm run build:lib | |
| - name: Release with Semantic Release | |
| run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |