|
| 1 | +name: CI Deploy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + paths: |
| 7 | + - 'apps/**' |
| 8 | + - 'libs/**' |
| 9 | + - 'package.json' |
| 10 | + - 'package-lock.json' |
| 11 | + - 'nx.json' |
| 12 | + - 'tsconfig.json' |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + pages: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 21 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 22 | +concurrency: |
| 23 | + group: "pages" |
| 24 | + cancel-in-progress: false |
| 25 | + |
| 26 | +jobs: |
| 27 | + build-and-deploy: |
| 28 | + name: Build and Deploy |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: checkout repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Setup Node.js |
| 36 | + uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version: 20 |
| 39 | + cache: 'npm' |
| 40 | + |
| 41 | + - name: Install dependencies |
| 42 | + run: npm ci |
| 43 | + |
| 44 | + # ================================================================= |
| 45 | + # == BUILD EACH APPLICATION == |
| 46 | + # ================================================================= |
| 47 | + |
| 48 | + - name: Build CDK Demo 🚀 |
| 49 | + run: npx nx build cdk-demo --configuration=production --base-href=/angular-ru-sdk/ |
| 50 | + |
| 51 | + - name: Build Excel Demo 🚀 |
| 52 | + run: npx nx build excel-demo --configuration=production --base-href=/angular-ru-sdk/excel-demo/ |
| 53 | + |
| 54 | + - name: Build Flex Layout Demo 🚀 |
| 55 | + run: npx nx build flex-layout-demo --configuration=production --base-href=/angular-ru-sdk/flex-layout-demo/ |
| 56 | + |
| 57 | + - name: Build Http Demo 🚀 |
| 58 | + run: npx nx build http-demo --configuration=production --base-href=/angular-ru-sdk/http-demo/ |
| 59 | + |
| 60 | + - name: Build Logger Demo 🚀 |
| 61 | + run: npx nx build logger-demo --configuration=production --base-href=/angular-ru-sdk/logger-demo/ |
| 62 | + |
| 63 | + - name: Build NGXS Demo 🚀 |
| 64 | + run: npx nx build ngxs-demo --configuration=production --base-href=/angular-ru-sdk/ngxs-demo/ |
| 65 | + |
| 66 | + - name: Build Tooltip Demo 🚀 |
| 67 | + run: npx nx build tooltip-demo --configuration=production --base-href=/angular-ru-sdk/tooltip-demo/ |
| 68 | + |
| 69 | + - name: Build Virtual Table Demo 🚀 |
| 70 | + run: npx nx build virtual-table-demo --configuration=production --base-href=/angular-ru-sdk/virtual-table-demo/ |
| 71 | + |
| 72 | + # ================================================================= |
| 73 | + # == PREPARE DEPLOYMENT ARTIFACTS == |
| 74 | + # ================================================================= |
| 75 | + |
| 76 | + - name: Stage artifacts for deployment |
| 77 | + run: | |
| 78 | + mkdir deploy |
| 79 | + cp -r dist/cdk-demo/* deploy/ |
| 80 | + mkdir deploy/excel-demo |
| 81 | + cp -r dist/excel-demo/* deploy/excel-demo/ |
| 82 | + mkdir deploy/flex-layout-demo |
| 83 | + cp -r dist/flex-layout-demo/* deploy/flex-layout-demo/ |
| 84 | + mkdir deploy/http-demo |
| 85 | + cp -r dist/http-demo/* deploy/http-demo/ |
| 86 | + mkdir deploy/logger-demo |
| 87 | + cp -r dist/logger-demo/* deploy/logger-demo/ |
| 88 | + mkdir deploy/ngxs-demo |
| 89 | + cp -r dist/ngxs-demo/* deploy/ngxs-demo/ |
| 90 | + mkdir deploy/tooltip-demo |
| 91 | + cp -r dist/tooltip-demo/* deploy/tooltip-demo/ |
| 92 | + mkdir deploy/virtual-table-demo |
| 93 | + cp -r dist/virtual-table-demo/* deploy/virtual-table-demo/ |
| 94 | + |
| 95 | + # Create a 404.html to handle SPA routing redirects |
| 96 | + cp deploy/index.html deploy/404.html |
| 97 | +
|
| 98 | + # ================================================================= |
| 99 | + # == DEPLOY TO GITHUB PAGES == |
| 100 | + # ================================================================= |
| 101 | + |
| 102 | + - name: Deploy to GitHub Pages 🌐 |
| 103 | + uses: peaceiris/actions-gh-pages@v4 |
| 104 | + with: |
| 105 | + github_token: ${{ secrets.ANGULAR_RU_BOT_PAT }} |
| 106 | + # The directory that contains the built and staged applications |
| 107 | + publish_dir: ./deploy |
0 commit comments