From 98bd9968c396142bef3dcc77c6897a44421c0f5e Mon Sep 17 00:00:00 2001 From: ztimson Date: Mon, 4 Dec 2023 22:42:56 -0500 Subject: [PATCH] Updated website docs & ci/cd --- .github/workflows/website.yml | 48 ++++++++++++++ .gitlab/.gitlab-ci.yml | 101 ----------------------------- LICENSE | 11 ++++ README.md | 116 ++++++++++++++++++++++++---------- angular.json | 8 +-- tsconfig.app.json | 15 ----- tsconfig.json | 65 ++++++++++--------- 7 files changed, 177 insertions(+), 187 deletions(-) create mode 100644 .github/workflows/website.yml delete mode 100644 .gitlab/.gitlab-ci.yml create mode 100644 LICENSE delete mode 100644 tsconfig.app.json diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 0000000..73376d5 --- /dev/null +++ b/.github/workflows/website.yml @@ -0,0 +1,48 @@ +name: Build Website +run-name: Build Website + +on: + push: + +jobs: + build: + name: Build NPM Project + runs-on: ubuntu-latest + container: node + steps: + - name: Clone Repository + uses: ztimson/actions/clone@develop + + - name: Install Dependencies + run: npm i + + - name: Build Project + run: npm run build + + - name: Upload Artifacts + if: ${{inputs.artifacts}} != "false" + uses: actions/upload-artifact@v3 + with: + name: website + path: dist + retention-days: 7 + tag: + name: Tag Version + needs: build + runs-on: ubuntu-latest + steps: + - name: Clone Repository + uses: ztimson/actions/clone@develop + + - name: Tag Version + uses: ztimson/actions/tag@develop + + publish: + name: Build & Push Dockerfile + needs: build + uses: ztimson/actions/.github/workflows/docker.yaml@develop + with: + dockerfile: website/Dockerfile + name: phone-reminders/website + repository: ${{github.server_url}}/${{github.repository}}.git + pass: ${{secrets.DEPLOY_TOKEN}} diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml deleted file mode 100644 index c68a040..0000000 --- a/.gitlab/.gitlab-ci.yml +++ /dev/null @@ -1,101 +0,0 @@ -image: node:16 - -stages: - - build - - test - - publish - - deploy - -npm: - stage: build - cache: - - key: - files: - - package-lock.json - paths: - - node_modules - policy: pull-push - - key: $CI_PIPELINE_ID - paths: - - dist - policy: push - script: - - npm install - - npm run build - artifacts: - paths: - - dist - expire_in: 1 week - rules: - - if: $CI_COMMIT_BRANCH - -audit: - stage: test - cache: - - key: - files: - - package-lock.json - paths: - - node_modules - policy: pull - script: - - echo "vulnerabilities_high $(npm audit | grep -oE '[0-9]+ high' | grep -oE '[0-9]+' || echo 0)" > metrics.txt - - echo "vulnerabilities_medium $(npm audit | grep -oE '[0-9]+ moderate' | grep -oE '[0-9]+' || echo 0)" >> metrics.txt - - echo "vulnerabilities_low $(npm audit | grep -oE '[0-9]+ low' | grep -oE '[0-9]+' || echo 0)" >> metrics.txt - artifacts: - reports: - metrics: metrics.txt - rules: - - if: $CI_COMMIT_BRANCH - -registry: - stage: publish - image: docker - cache: - - key: $CI_PIPELINE_ID - paths: - - dist - policy: pull - before_script: - - docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY - - TAG=$([ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ] && echo "latest" || echo "$CI_COMMIT_BRANCH" | sed -E "s/[_/]/-/g") - script: - - docker build --no-cache -t "$CI_REGISTRY_IMAGE:$TAG" . - - docker push "$CI_REGISTRY_IMAGE:$TAG" - allow_failure: true - rules: - - if: $CI_COMMIT_BRANCH - -tag: - stage: publish - image: - name: alpine/git - entrypoint: [""] - cache: [] - before_script: - - git remote set-url origin "https://ReleaseBot:$DEPLOY_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git" - - VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+') - script: - - git tag -f $VERSION $CI_COMMIT_SHA - - git push -f origin $VERSION - allow_failure: true - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - -production: - stage: deploy - image: docker - cache: [] - variables: - SERVICE_NAME: legio-xxx_web - before_script: - - docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY - - TAG=$([ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ] && echo "latest" || echo "$CI_COMMIT_BRANCH" | sed -E "s/[_/]/-/g") - script: - - docker pull "$CI_REGISTRY_IMAGE:$TAG" - - docker service update --force --with-registry-auth --image "$CI_REGISTRY_IMAGE:$TAG" "$SERVICE_NAME" || echo "Continuing in background" - allow_failure: true - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - - diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6b3783a --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright (c) 2023 Zakary Timson + +All Rights Reserved. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index fdff555..f049aa7 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,95 @@ -# LEGIO · XXX -Legio XXX is the website for a North American Roman re-enactment group. + +
+
-[View here](https://legio-30.org) + + Logo -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.2. + + ### Legio • XXX + + + Roman Re-Enactment Website + + + [![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/legio-30/tags&query=$[0].name)](https://git.zakscode.com/ztimson/legio-30/tags) + [![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/legio-30&query=open_pr_counter)](https://git.zakscode.com/ztimson/legio-30/pulls) + [![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/legio-30&query=open_issues_count)](https://git.zakscode.com/ztimson/legio-30/issues) + + + + --- +
+ Release Notes + • Report a Bug + • Request a Feature +
+ + --- +
## Table of Contents -[[_TOC_]] +- [Legio • XXX](#top) + - [About](#about) + - [Demo](#demo) + - [Built With](#built-with) + - [Setup](#setup) + - [Production](#production) + - [Development](#development) + - [License](#license) -## Prerequisites -- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) -- [NodeJS 16](https://nodejs.org/en/) -- _[Docker](https://docs.docker.com/install/) (Optional)_ +## About + +Legio XXX is a non-profit re-enactment group from southern Ontario & the north-eastern USA. It was established in 2004 with the goal of portraying all aspects of Roman military & civilian life. + +This website was built to help educate the public and advertise events. + +The website was written using Angular. + +### Demo + +Website: https://legio-30.org + +### Built With +[![Angular](https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular)](https://angular.io/) +[![Docker](https://img.shields.io/badge/Docker-384d54?style=for-the-badge&logo=docker)](https://docker.com/) +[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://typescriptlang.org/) ## Setup -The project can either be run using NPM or Docker. NPM is recommended for development. -
-NPM +
+ +

+ Production +

+
+ +#### Prerequisites +- [Docker](https://docs.docker.com/install/) + +#### Instructions +1. Run the docker image: `docker run -p 80:80 git.zakscode.com/ztimson/template:latest` +2. Open [http://localhost](http://localhost) +
+ +
+ +

+ Development +

+
+ +#### Prerequisites +- [Node.js](https://nodejs.org/en/download) + +#### Instructions 1. Install the dependencies: `npm install` 2. Start the Angular server: `npm run start` -
- -
-Docker - -1. Build the docker image: `docker build -t legio-xxx: .` -2. Start the new image: `docker run -p 4200:80 legio-xxx:` +3. Open [http://localhost:4200](http://localhost:4200)
-The website should now be accessible on [http://localhost:4200](http://localhost:4200) - -## Cheatsheet -```bash -# Start Angular server -npm run start - -# Build production -npm run build:prod - -# Build docker image -docker build -t legio-xxx: - -# Run docker image -docker run -p 4200:80 legio-xxx: -``` +## License +Copyright © 2023 Zakary Timson | All Rights Reserved +See the [license](./LICENSE) for more information. diff --git a/angular.json b/angular.json index 97d2e5f..24b87c3 100644 --- a/angular.json +++ b/angular.json @@ -21,7 +21,7 @@ "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.app.json", + "tsConfig": "tsconfig.json", "inlineStyleLanguage": "scss", "assets": [ "src/assets" @@ -75,12 +75,6 @@ } }, "defaultConfiguration": "development" - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "LegioXXX:build" - } } } } diff --git a/tsconfig.app.json b/tsconfig.app.json deleted file mode 100644 index 82d91dc..0000000 --- a/tsconfig.app.json +++ /dev/null @@ -1,15 +0,0 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./out-tsc/app", - "types": [] - }, - "files": [ - "src/main.ts", - "src/polyfills.ts" - ], - "include": [ - "src/**/*.d.ts" - ] -} diff --git a/tsconfig.json b/tsconfig.json index ff06eae..c85f7fd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,32 +1,39 @@ /* To learn more about this file see: https://angular.io/config/tsconfig. */ { - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "sourceMap": true, - "declaration": false, - "downlevelIteration": true, - "experimentalDecorators": true, - "moduleResolution": "node", - "importHelpers": true, - "target": "es2020", - "module": "es2020", - "lib": [ - "es2020", - "dom" - ] - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true - } + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./out-tsc/app", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "importHelpers": true, + "target": "es2020", + "module": "es2020", + "lib": [ + "es2020", + "dom" + ] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" + ], + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } }