Skip to content

Commit

Permalink
Deploy to Github Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
sixcorners committed Jan 14, 2025
1 parent acfd416 commit cc2801d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 11 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ jobs:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build --if-present
- run: npm test -- --no-watch --no-progress --browsers=ChromeHeadless --code-coverage --reporters junit
- uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
- run: npm run build --if-present -- --base-href .
- uses: actions/upload-pages-artifact@v3
with:
files: TESTS-*.xml

path: dist/tso-tools/browser
deploy:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment
18 changes: 18 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build --if-present
- run: npm test -- --no-watch --no-progress --browsers=ChromeHeadless --code-coverage --reporters junit
- uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: TESTS-*.xml
16 changes: 11 additions & 5 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { ApplicationConfig, provideZoneChangeDetection, isDevMode } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideRouter, RouterFeatures, withHashLocation } from '@angular/router';

import { routes } from './app.routes';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { provideServiceWorker } from '@angular/service-worker';

import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';

const routerFeatures: RouterFeatures[] = [];

// switch from the History API / pushState navigation if the base url is fully relative
const base = document.querySelector('base')?.getAttribute('href');
if (!base?.startsWith('/') && !base?.includes('://')) routerFeatures.push(withHashLocation());

export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideAnimationsAsync(), provideServiceWorker('ngsw-worker.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000'
}), {provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: {duration: 2500}}]
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes, ...routerFeatures), provideAnimationsAsync(), provideServiceWorker('ngsw-worker.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000'
}), { provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { duration: 2500 } }]
};

0 comments on commit cc2801d

Please sign in to comment.