|
4 | 4 | branches: |
5 | 5 | - master |
6 | 6 |
|
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + cancel-in-progress: false |
| 10 | + |
7 | 11 | permissions: |
8 | | - id-token: write # Required for OIDC |
| 12 | + id-token: write |
9 | 13 | contents: read |
10 | 14 |
|
11 | 15 | jobs: |
12 | | - deploy: |
| 16 | + ci: |
| 17 | + name: ci |
13 | 18 | runs-on: ubuntu-latest |
14 | 19 | steps: |
15 | 20 | - uses: actions/checkout@v4 |
16 | 21 |
|
17 | 22 | - uses: actions/setup-node@v4 |
18 | 23 | with: |
19 | 24 | node-version: 24 |
20 | | - registry-url: 'https://registry.npmjs.org' |
| 25 | + cache: npm |
| 26 | + |
| 27 | + - run: npm ci |
21 | 28 |
|
22 | | - - run: | |
23 | | - docker build . --target=test-components -t zvoove-angular-components:test-comp |
24 | | - docker build . --target=test-schematics -t zvoove-angular-components:test-schem |
25 | | - docker build . --target=linter -t zvoove-angular-components:lint |
26 | | - name: build ci images |
| 29 | + - name: Lint |
| 30 | + run: npm run lint |
27 | 31 |
|
28 | | - - run: docker run --rm zvoove-angular-components:lint |
29 | | - name: run linter |
| 32 | + - name: Test components |
| 33 | + run: npm run test:components |
30 | 34 |
|
31 | | - - run: docker run --rm zvoove-angular-components:test-comp |
32 | | - name: test components |
| 35 | + - name: Test schematics |
| 36 | + run: npm run test:schematics |
33 | 37 |
|
34 | | - - run: docker run --rm zvoove-angular-components:test-schem |
35 | | - name: test schematics |
36 | | - - run: npm ci |
| 38 | + - name: Build components |
| 39 | + run: npm run build:components |
| 40 | + |
| 41 | + - name: Build demo |
| 42 | + run: npm run build:components-demo -- --base-href /components/ |
| 43 | + |
| 44 | + - name: Upload components artifact |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: components-dist |
| 48 | + path: dist/components |
| 49 | + |
| 50 | + - name: Upload demo artifact |
| 51 | + uses: actions/upload-pages-artifact@v3 |
| 52 | + with: |
| 53 | + path: dist/zvoove-components-demo/browser |
| 54 | + |
| 55 | + publish: |
| 56 | + name: publish to npm |
| 57 | + needs: ci |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - uses: actions/setup-node@v4 |
| 61 | + with: |
| 62 | + node-version: 24 |
| 63 | + registry-url: 'https://registry.npmjs.org' |
37 | 64 |
|
38 | | - - run: npm run build:components |
| 65 | + - name: Download components artifact |
| 66 | + uses: actions/download-artifact@v4 |
| 67 | + with: |
| 68 | + name: components-dist |
| 69 | + path: dist/components |
| 70 | + |
| 71 | + - name: Check if version already published |
| 72 | + id: version-check |
| 73 | + run: | |
| 74 | + LOCAL=$(node -p "require('./dist/components/package.json').version") |
| 75 | + REMOTE=$(npm view @zvoove/components version 2>/dev/null || echo "0.0.0") |
| 76 | + echo "should_publish=$( [ "$LOCAL" != "$REMOTE" ] && echo true || echo false )" >> "$GITHUB_OUTPUT" |
39 | 77 |
|
40 | 78 | - name: Publish to npm |
| 79 | + if: steps.version-check.outputs.should_publish == 'true' |
41 | 80 | run: npm publish ./dist/components --provenance --access public |
| 81 | + |
| 82 | + deploy-demo: |
| 83 | + name: deploy demo to github pages |
| 84 | + needs: ci |
| 85 | + runs-on: ubuntu-latest |
| 86 | + permissions: |
| 87 | + pages: write |
| 88 | + id-token: write |
| 89 | + environment: |
| 90 | + name: github-pages |
| 91 | + url: ${{ steps.deployment.outputs.page_url }} |
| 92 | + steps: |
| 93 | + - name: Deploy to GitHub Pages |
| 94 | + id: deployment |
| 95 | + uses: actions/deploy-pages@v4 |
0 commit comments