diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 055be86..53d4b77 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,3 +48,49 @@ jobs: uses: ztimson/actions/tag@develop with: tag: ${{env.VERSION}} + + + docs: + name: Publish Documentation + needs: build + runs-on: ubuntu-latest + container: docker + steps: + - name: Clone Repository + uses: ztimson/actions/clone@develop + + - name: Get Version Number + shell: sh + run: | + [[ -f server/package.json ]] && echo "VERSION=$(cat server/package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV + + - name: Push with branch tag + uses: ztimson/actions/docker/push@develop + with: + registry: ${{github.server_url}} + user: ${{github.repository_owner}} + pass: ${{secrets.DEPLOY_TOKEN}} + name: ${{github.repository}} + tag: ${{github.ref_name}} + + - name: Push with version tag + uses: ztimson/actions/docker/push@develop + if: ${{env.VERSION}} + with: + from: "${{github.server_url}}/${{github.repository}}:${{github.ref_name}}" + registry: ${{github.server_url}} + user: ${{github.repository_owner}} + pass: ${{secrets.DEPLOY_TOKEN}} + name: ${{github.repository}} + tag: ${{env.VERSION}} + + - name: Push with latest tag + uses: ztimson/actions/docker/push@develop + if: ${{github.ref_name}} == (git symbolic-ref refs/remotes/origin/HEAD --short | cut -c 7) + with: + from: "${{github.server_url}}/${{github.repository}}:${{github.ref_name}}" + registry: ${{github.server_url}} + user: ${{github.repository_owner}} + pass: ${{secrets.DEPLOY_TOKEN}} + name: ${{github.repository}} + tag: latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..76cd41c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Build application +FROM node:alpine as build + +RUN mkdir /app +WORKDIR /app +COPY . . +RUN if [ ! -d "docs" ]; then npm install && npm run docs; fi + +# Use Nginx to serve +FROM nginx:1.23-alpine + +COPY --from=build /app/docs /usr/share/nginx/html diff --git a/package.json b/package.json index 621a9d2..7b2306b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "scripts": { "build": "npx tsc && npx vite build", - "docs": "typedoc --plugin typedoc-plugin-markdown --cleanOutputDir false --outputFileStrategy modules --hidePageHeader --out ./docs --entryPoints src/**/*.ts --readme none --entryFileName Home", + "docs": "typedoc --cleanOutputDir false --out ./docs --entryPoints src/**/*.ts --readme none", "test": "npx jest", "test:coverage": "npx jest --coverage", "watch": "npx vite build --watch" @@ -32,7 +32,6 @@ "jest-junit": "^16.0.0", "ts-jest": "^29.1.2", "typedoc": "^0.26.7", - "typedoc-plugin-markdown": "^4.2.7", "typescript": "^5.3.3", "vite": "^5.0.12", "vite-plugin-dts": "^3.7.2"