Updated website docs & ci/cd

This commit is contained in:
Zakary Timson 2023-12-04 22:42:56 -05:00
parent 18904dcb24
commit 98bd9968c3
7 changed files with 177 additions and 187 deletions

48
.github/workflows/website.yml vendored Normal file
View File

@ -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}}

View File

@ -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'

11
LICENSE Normal file
View File

@ -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.

116
README.md
View File

@ -1,49 +1,95 @@
# LEGIO · XXX <!-- Header -->
Legio XXX is the website for a North American Roman re-enactment group. <div id="top" align="center">
<br />
[View here](https://legio-30.org) <!-- Logo -->
<img src="./src/assets/img/eagle.png" alt="Logo" width="200" height="200">
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.2. <!-- Title -->
### Legio • XXX
<!-- Description -->
Roman Re-Enactment Website
<!-- Repo badges -->
[![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)
<!-- Links -->
---
<div>
<a href="https://git.zakscode.com/ztimson/legio-30/releases" target="_blank">Release Notes</a>
<a href="https://git.zakscode.com/ztimson/legio-30/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
<a href="https://git.zakscode.com/ztimson/legio-30/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
</div>
---
</div>
## Table of Contents ## Table of Contents
[[_TOC_]] - [Legio • XXX](#top)
- [About](#about)
- [Demo](#demo)
- [Built With](#built-with)
- [Setup](#setup)
- [Production](#production)
- [Development](#development)
- [License](#license)
## Prerequisites ## About
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- [NodeJS 16](https://nodejs.org/en/) 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.
- _[Docker](https://docs.docker.com/install/) (Optional)_
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 ## Setup
The project can either be run using NPM or Docker. NPM is recommended for development.
<details>
<summary>NPM</summary>
<details>
<summary>
<h3 id="production" style="display: inline">
Production
</h3>
</summary>
#### 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)
</details>
<details>
<summary>
<h3 id="development" style="display: inline">
Development
</h3>
</summary>
#### Prerequisites
- [Node.js](https://nodejs.org/en/download)
#### Instructions
1. Install the dependencies: `npm install` 1. Install the dependencies: `npm install`
2. Start the Angular server: `npm run start` 2. Start the Angular server: `npm run start`
</details> 3. Open [http://localhost:4200](http://localhost:4200)
<details>
<summary>Docker</summary>
1. Build the docker image: `docker build -t legio-xxx:<TAG> .`
2. Start the new image: `docker run -p 4200:80 legio-xxx:<TAG>`
</details> </details>
The website should now be accessible on [http://localhost:4200](http://localhost:4200) ## License
Copyright © 2023 Zakary Timson | All Rights Reserved
## Cheatsheet
```bash
# Start Angular server
npm run start
# Build production
npm run build:prod
# Build docker image
docker build -t legio-xxx:<TAG>
# Run docker image
docker run -p 4200:80 legio-xxx:<TAG>
```
See the [license](./LICENSE) for more information.

View File

@ -21,7 +21,7 @@
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json", "tsConfig": "tsconfig.json",
"inlineStyleLanguage": "scss", "inlineStyleLanguage": "scss",
"assets": [ "assets": [
"src/assets" "src/assets"
@ -75,12 +75,6 @@
} }
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "LegioXXX:build"
}
} }
} }
} }

View File

@ -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"
]
}

View File

@ -3,7 +3,7 @@
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"baseUrl": "./", "baseUrl": "./",
"outDir": "./dist/out-tsc", "outDir": "./out-tsc/app",
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"noImplicitOverride": true, "noImplicitOverride": true,
@ -23,6 +23,13 @@
"dom" "dom"
] ]
}, },
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"angularCompilerOptions": { "angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false, "enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true, "strictInjectionParameters": true,