diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml deleted file mode 100644 index 344de1d..0000000 --- a/.forgejo/workflows/build.yaml +++ /dev/null @@ -1,91 +0,0 @@ -on: - push: - workflow_dispatch: - inputs: - build: - description: "Build container" - required: false - default: false - type: boolean - -jobs: - build: - runs-on: container - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get the version from git - id: version - run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT - - - name: Check if the container should be built - id: builder - env: - RUN: ${{ toJSON(inputs.build || !contains(steps.version.outputs.version, '-')) }} - run: | - echo "run=$RUN" >> $GITHUB_OUTPUT - echo "Run build: $RUN" - - - name: Info - version and if the image container should be built - env: - VERSION: ${{ steps.version.outputs.version }} - RUN: ${{ steps.builder.outputs.run }} - FORCE: ${{ toJSON(inputs.build) }} - run: | - echo "Version $VERSION, force (manual input): $FORCE, run the build: $RUN" - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - run_install: false - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build package (transpile ts => js) - run: ng build - - #- name: Git unshallow - get all history from Git to get the tag for the computation of the version - # if: ${{ inputs.build }} - # run: git pull --unshallow - - - name: Build container - if: fromJSON(steps.builder.outputs.run) - uses: actions/buildah-build@v1 - with: - image: treetrail-frontend - oci: true - labels: treetrail-frontend - tags: ${{ steps.version.outputs.version }} - containerfiles: | - ./Containerfile - - - name: Workaround for bug of podman-login - if: fromJSON(steps.builder.outputs.run) - run: | - mkdir -p $HOME/.docker - echo "{ \"auths\": {} }" > $HOME/.docker/config.json - - - name: Log in to container registry (with another workaround) - if: fromJSON(steps.builder.outputs.run) - uses: actions/podman-login@v1 - with: - registry: ${{ vars.REGISTRY }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} - auth_file_path: /tmp/auth.json - - - uses: actions/push-to-registry@v2 - if: fromJSON(steps.builder.outputs.run) - with: - registry: "docker://${{ vars.REGISTRY }}" - image: treetrail-frontend - tags: ${{ steps.version.outputs.version }} diff --git a/.gitignore b/.gitignore index 105c00f..ee6bec4 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ testem.log # System Files .DS_Store Thumbs.db + +.npmrc diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..24c4254 --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,50 @@ +when: + - event: manual + - event: tag + +#depends_on: + #- test + +steps: + npm: + image: code.philo.ydns.eu/philorg/pnpm-deb + environment: + ORG: philorg + REGISTRY_TOKEN: + from_secret: registry_token + volumes: + - pnpm:/root/.local/share/pnpm + commands: + - pnpm install --frozen-lockfile + - pnpm set "//code.philo.ydns.eu/api/packages/$ORG/npm/:_authToken=$REGISTRY_TOKEN" + - pnpm publish --no-git-checks + failure: ignore + + build: + image: code.philo.ydns.eu/philorg/pnpm-deb + commands: + - pnpm build + + build_publish: + image: quay.io/podman/stable:latest + # Caution: This image is built daily. It might fill up your image store quickly. + #pull: true + volumes: + - containers:/var/lib/containers + - pnpm:/root/.local/share/pnpm + # Fill in the trusted checkbox in Woodpecker's settings as well + privileged: true + environment: + registry: code.philo.ydns.eu + org: philorg + container_name: treetrail-frontend + registry_token: + from_secret: registry_token + commands: + # Login at the registry + - podman login -u __token__ --password $registry_token $registry + # Build the container image + - podman build --volume=/var/lib/containers:/var/lib/containers --tag $registry/$org/$container_name:latest --tag $registry/$org/$container_name:$CI_COMMIT_TAG . + # Push the image + - podman push $registry/$org/$container_name:latest + - podman push $registry/$org/$container_name:$CI_COMMIT_TAG diff --git a/README.md b/README.md index d692ad1..ede9083 100644 --- a/README.md +++ b/README.md @@ -1 +1,10 @@ -Front-end for *Tree Trail*, a fun and pedagogic tool to discover the trails and trees around. \ No newline at end of file +# Treetrail web front-end + +Front-end for *Tree Trail*, a fun and pedagogic tool +to discover the trails and trees around. + +Home page (source, bugs, etc): + . + +The main documentation for Tree Trail is: + . diff --git a/build.yaml b/build.yaml index 0ed0cf8..0bd92e0 100644 --- a/build.yaml +++ b/build.yaml @@ -1,8 +1,11 @@ -- name: Build container +- name: Build container image hosts: localhost gather_facts: false vars: repository: tiptop:5000 + force_rm: false + cache: false + tasks: - name: Install dependencies command: pnpm install @@ -20,6 +23,11 @@ args: chdir: "{{ playbook_dir }}" + - name: Update version.json + command: pnpm run version + args: + chdir: "{{ playbook_dir }}" + - name: Build frontend container containers.podman.podman_image: name: "treetrail-frontend:{{ version.stdout }}" @@ -28,8 +36,10 @@ path: "{{ playbook_dir }}" build: format: oci - cache: no + force_rm: "{{ force_rm }}" + cache: "{{ cache }}" file: Containerfile + extra_args: "--build-arg APP_VERSION={{ version.stdout }}" push: true push_args: dest: "{{ repository }}/treetrail-frontend:{{ version.stdout }}" diff --git a/package-lock.json b/package-lock.json index 55c3ef2..91aa9a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "treetrail", - "version": "0.0.0", + "version": "0.4.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "treetrail", - "version": "0.0.0", + "version": "0.4.5", "dependencies": { "@angular/animations": "^18.2.6", "@angular/cdk": "^18.2.6", diff --git a/package.json b/package.json index 0638632..b408455 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,14 @@ { - "name": "treetrail", - "version": "0.0.0", + "name": "treetrail-frontend", + "version": "0.4.5", "scripts": { "ng": "ng", - "start": "ng serve --proxy-config proxy.conf.json --port 4201 --serve-path /treetrail", + "start": "ng serve --proxy-config proxy.conf.json --port 4201 --serve-path /treetrail --host 0.0.0.0", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", "openapi-ts": "openapi-ts" }, - "private": true, "dependencies": { "@angular/animations": "^18.2.6", "@angular/cdk": "^18.2.6", @@ -61,5 +60,8 @@ "karma-jasmine-html-reporter": "^2.1.0", "typescript": "~5.4.5" }, - "packageManager": "pnpm@9.12.2" + "packageManager": "pnpm@9.12.2", + "publishConfig": { + "registry": "http://code.philo.ydns.eu/api/packages/philorg/npm/" + } } diff --git a/src/app/about/about.component.html b/src/app/about/about.component.html index c7e6ba7..6bd500d 100644 --- a/src/app/about/about.component.html +++ b/src/app/about/about.component.html @@ -4,7 +4,7 @@

Version

-

Client: {{ (configService.conf | async).bootstrap.client.version }}>

+

Client: {{ version }}>

Server: {{ (configService.conf | async).bootstrap.server.version }}

\ No newline at end of file diff --git a/src/app/about/about.component.ts b/src/app/about/about.component.ts index edfc557..26596b4 100644 --- a/src/app/about/about.component.ts +++ b/src/app/about/about.component.ts @@ -1,6 +1,7 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit } from '@angular/core' import { ConfigService } from '../config.service' +import packageJson from '../../../package.json' @Component({ selector: 'app-about', @@ -12,6 +13,8 @@ export class AboutComponent implements OnInit { public configService: ConfigService, ) { } + public version: string = packageJson.version + ngOnInit(): void { } } diff --git a/src/app/app.component.scss b/src/app/app.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 52a84ae..70dc380 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,7 @@ -import { Component, OnInit, - ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core' +import { + Component, OnInit, + ChangeDetectorRef, ChangeDetectionStrategy +} from '@angular/core' import { DataService } from './data.service' import { ActionService } from './action.service' @@ -10,7 +12,6 @@ import { combineLatest } from 'rxjs' @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class AppComponent implements OnInit { @@ -20,7 +21,7 @@ export class AppComponent implements OnInit { public actionService: ActionService, public appUpdateService: AppUpdateService, public cdr: ChangeDetectorRef, - ) {} + ) { } title = 'treetrail' ngOnInit(): void { diff --git a/src/app/profile/profile.component.scss b/src/app/profile/profile.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index 16fa22f..c5b8ea6 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -3,7 +3,6 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-profile', templateUrl: './profile.component.html', - styleUrls: ['./profile.component.scss'] }) export class ProfileComponent { diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index 2032ada..3dd65d4 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -108,7 +108,7 @@
  • Dave Storey: communication
  • Contact: phil.treetrail at philome.mooo.com

    -

    Version: {{conf.bootstrap?.client.version }}

    +

    Version: {{conf.bootstrap?.client.version }}, frontend: {{ version }}

    diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 498387d..9157906 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -3,6 +3,7 @@ import { Router } from '@angular/router' import { ActionService } from '../action.service' import { ConfigService, Config } from '../config.service' +import packageJson from '../../../package.json' @Component({ selector: 'app-settings', @@ -17,6 +18,8 @@ export class SettingsComponent implements OnInit { public router: Router, ) { } + public version: string = packageJson.version + ngOnInit(): void { this.configService.conf.subscribe( conf => this.conf = conf diff --git a/src/assets/.gitkeep b/src/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/assets/fonts/.gitignore b/src/assets/fonts/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/tsconfig.json b/tsconfig.json index 78cbf2f..b149b41 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,8 @@ "importHelpers": true, "target": "ES2022", "module": "es2020", + //"allowSyntheticDefaultImports": true, + "resolveJsonModule": true, "lib": [ "es2019", "dom"