Merge branch 'main' into refactor/update-med-calls

This commit is contained in:
Matt DiMeglio 2026-03-04 00:20:35 -05:00
commit 254b86a6af
16 changed files with 7297 additions and 1972 deletions

View file

@ -1,95 +1,101 @@
name: API Deployment Container name: API Deployment Container
on: on:
workflow_dispatch: {} workflow_dispatch: {}
pull_request: pull_request:
branches: branches:
- main - main
types: types:
- opened - opened
- reopened - reopened
- synchronize - synchronize
- ready_for_review - ready_for_review
push: paths:
branches: - api/**
- main push:
paths: branches:
- api/** - main
jobs: paths:
determine-workflow: - api/**
runs-on: 'ubuntu-latest' jobs:
outputs: determine-workflow:
workflow_type: ${{ steps.workflow.outputs.workflow_type }} runs-on: 'ubuntu-latest'
workflow_envs: ${{ steps.workflow.outputs.workflow_envs }} outputs:
release_type: ${{ steps.workflow.outputs.release_type }} workflow_type: ${{ steps.workflow.outputs.workflow_type }}
current_version: ${{ steps.version.outputs.current_version }} workflow_envs: ${{ steps.workflow.outputs.workflow_envs }}
steps: release_type: ${{ steps.workflow.outputs.release_type }}
- name: Checkout Code current_version: ${{ steps.version.outputs.current_version }}
uses: actions/checkout@v4 steps:
- name: Determine Workflow - name: Checkout Code
id: workflow uses: actions/checkout@v4
shell: bash - name: Determine Workflow
run: | id: workflow
event=${{ github.event_name }} shell: bash
workflow_type='dev'; run: |
workflow_envs='["dev"]' event=${{ github.event_name }}
if [[ $event == 'workflow_dispatch' && '${{ github.ref_name }}' == 'main' ]]; workflow_type='dev';
then workflow_envs='["dev"]'
echo "in if statement" if [[ $event == 'workflow_dispatch' && '${{ github.ref_name }}' == 'main' ]];
workflow_type='release'; then
workflow_envs='["prod"]' echo "in if statement"
fi workflow_type='release';
workflow_envs='["prod"]'
echo "workflow_type=$workflow_type" >> $GITHUB_OUTPUT fi
echo "workflow_envs=$workflow_envs" >> $GITHUB_OUTPUT
echo "workflow_type=$workflow_type" >> $GITHUB_OUTPUT
echo "Running $workflow_type pipeline in environments: $workflow_envs" >> $GITHUB_STEP_SUMMARY echo "workflow_envs=$workflow_envs" >> $GITHUB_OUTPUT
- name: Extract Version
id: version echo "Running $workflow_type pipeline in environments: $workflow_envs" >> $GITHUB_STEP_SUMMARY
shell: bash - name: Extract Version
run: | id: version
version=$(jq -r '.version' api/package.json) shell: bash
echo "current_version=$version" >> "$GITHUB_OUTPUT" run: |
nonprod-deploy: version=$(jq -r '.version' api/package.json)
needs: determine-workflow echo "current_version=$version" >> "$GITHUB_OUTPUT"
if: needs.determine-workflow.outputs.workflow_type != 'release' nonprod-deploy:
strategy: needs: determine-workflow
max-parallel: 1 if: needs.determine-workflow.outputs.workflow_type != 'release'
matrix: strategy:
env: ${{ fromJson(needs.determine-workflow.outputs.workflow_envs) }} max-parallel: 1
uses: ./.github/workflows/api-deploy-nonprod.yml matrix:
with: env: ${{ fromJson(needs.determine-workflow.outputs.workflow_envs) }}
environments: ${{ matrix.env }} uses: ./.github/workflows/api-deploy-nonprod.yml
workflow_type: ${{ needs.determine-workflow.outputs.workflow_type }} with:
branch: ${{ github.head_ref || github.ref_name }} environments: ${{ matrix.env }}
current_version: ${{ needs.determine-workflow.outputs.current_version }} workflow_type: ${{ needs.determine-workflow.outputs.workflow_type }}
secrets: branch: ${{ github.head_ref || github.ref_name }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} current_version: ${{ needs.determine-workflow.outputs.current_version }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} secrets:
TEST: ${{ secrets.TEST }} DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
COOLIFY_WEBHOOK_API: ${{ secrets.COOLIFY_WEBHOOK_API }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }} TEST: ${{ secrets.TEST }}
permissions: TEAMCITY_API_ID: ${{ secrets.TEAMCITY_API_ID }}
contents: read TEAMCITY_URL: ${{ secrets.TEAMCITY_URL }}
packages: write TEAMCITY_USERNAME: ${{ secrets.TEAMCITY_USERNAME }}
prod-deploy: TEAMCITY_PASSWORD: ${{ secrets.TEAMCITY_PASSWORD }}
needs: determine-workflow permissions:
if: needs.determine-workflow.outputs.workflow_type == 'release' contents: read
strategy: packages: write
max-parallel: 1 prod-deploy:
matrix: needs: determine-workflow
env: ${{ fromJson(needs.determine-workflow.outputs.workflow_envs) }} if: needs.determine-workflow.outputs.workflow_type == 'release'
uses: ./.github/workflows/api-deploy-prod.yml strategy:
with: max-parallel: 1
environments: ${{ matrix.env }} matrix:
workflow_type: ${{ needs.determine-workflow.outputs.workflow_type }} env: ${{ fromJson(needs.determine-workflow.outputs.workflow_envs) }}
branch: ${{ github.head_ref || github.ref_name }} uses: ./.github/workflows/api-deploy-prod.yml
current_version: ${{ needs.determine-workflow.outputs.current_version }} with:
secrets: environments: ${{ matrix.env }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} workflow_type: ${{ needs.determine-workflow.outputs.workflow_type }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} branch: ${{ github.head_ref || github.ref_name }}
TEST: ${{ secrets.TEST }} current_version: ${{ needs.determine-workflow.outputs.current_version }}
COOLIFY_WEBHOOK_API: ${{ secrets.COOLIFY_WEBHOOK_API }} secrets:
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }} DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
permissions: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
contents: read TEST: ${{ secrets.TEST }}
packages: write TEAMCITY_API_ID: ${{ secrets.TEAMCITY_API_ID }}
TEAMCITY_URL: ${{ secrets.TEAMCITY_URL }}
TEAMCITY_USERNAME: ${{ secrets.TEAMCITY_USERNAME }}
TEAMCITY_PASSWORD: ${{ secrets.TEAMCITY_PASSWORD }}
permissions:
contents: read
packages: write

View file

@ -22,8 +22,10 @@ on:
DOCKERHUB_USER: {} DOCKERHUB_USER: {}
DOCKERHUB_TOKEN: {} DOCKERHUB_TOKEN: {}
TEST: {} TEST: {}
COOLIFY_WEBHOOK_API: {} TEAMCITY_API_ID: {}
COOLIFY_TOKEN: {} TEAMCITY_URL: {}
TEAMCITY_USERNAME: {}
TEAMCITY_PASSWORD: {}
jobs: jobs:
check-inputs: check-inputs:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
@ -31,17 +33,29 @@ jobs:
steps: steps:
- name: Check secrets present - name: Check secrets present
run: | run: |
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_API }}" ]]; then if [[ -z "${{ secrets.TEAMCITY_API_ID }}" ]]; then
echo "COOLIFY_WEBHOOK_API secret is empty or missing" echo "TEAMCITY_API_ID secret is empty or missing"
exit 1 exit 1
else else
echo "COOLIFY_WEBHOOK_API secret is set" echo "TEAMCITY_API_ID secret is set"
fi fi
if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then if [[ -z "${{ secrets.TEAMCITY_URL }}" ]]; then
echo "COOLIFY_TOKEN secret is empty or missing" echo "TEAMCITY_URL secret is empty or missing"
exit 1 exit 1
else else
echo "COOLIFY_TOKEN secret is set" echo "TEAMCITY_URL secret is set"
fi
if [[ -z "${{ secrets.TEAMCITY_USERNAME }}" ]]; then
echo "TEAMCITY_USERNAME secret is empty or missing"
exit 1
else
echo "TEAMCITY_USERNAME secret is set"
fi
if [[ -z "${{ secrets.TEAMCITY_PASSWORD }}" ]]; then
echo "TEAMCITY_PASSWORD secret is empty or missing"
exit 1
else
echo "TEAMCITY_PASSWORD secret is set"
fi fi
if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then
echo "DOCKERHUB_USER secret is empty or missing" echo "DOCKERHUB_USER secret is empty or missing"
@ -88,7 +102,12 @@ jobs:
contents: read contents: read
packages: write packages: write
steps: steps:
- name: Deploy to Coolify - name: Deploy to Team City
run: | run: |
curl '${{ secrets.COOLIFY_WEBHOOK_API }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}' curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \
-X POST \
-H "Content-Type: application/json" \
-d '{"buildType": {"id": "${{ secrets.TEAMCITY_API_ID }}"}}' \
"${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue" > /dev/null

View file

@ -1,94 +1,111 @@
name: API Deployment Production name: API Deployment Production
on: on:
workflow_call: workflow_call:
inputs: inputs:
environments: environments:
type: string type: string
description: An optional list of environments to deploy to. description: An optional list of environments to deploy to.
default: 'prod' default: 'prod'
workflow_type: workflow_type:
type: string type: string
description: An optional string for workflow types. description: An optional string for workflow types.
default: 'prod' default: 'prod'
branch: branch:
type: string type: string
description: An optional string to define which branch to checkout. description: An optional string to define which branch to checkout.
default: 'main' default: 'main'
current_version: current_version:
type: string type: string
description: Current Version of the package.json. description: Current Version of the package.json.
default: '0.0.0' default: '0.0.0'
secrets: secrets:
DOCKERHUB_USER: {} DOCKERHUB_USER: {}
DOCKERHUB_TOKEN: {} DOCKERHUB_TOKEN: {}
TEST: {} TEST: {}
COOLIFY_WEBHOOK_API: {} TEAMCITY_API_ID: {}
COOLIFY_TOKEN: {} TEAMCITY_URL: {}
jobs: TEAMCITY_USERNAME: {}
check-inputs: TEAMCITY_PASSWORD: {}
runs-on: 'ubuntu-latest' jobs:
environment: ${{ inputs.environments }} check-inputs:
steps: runs-on: 'ubuntu-latest'
- name: Check secrets present environment: ${{ inputs.environments }}
run: | steps:
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_API }}" ]]; then - name: Check secrets present
echo "COOLIFY_WEBHOOK_API secret is empty or missing" run: |
exit 1 if [[ -z "${{ secrets.TEAMCITY_API_ID }}" ]]; then
else echo "TEAMCITY_API_ID secret is empty or missing"
echo "COOLIFY_WEBHOOK_API secret is set" exit 1
fi else
if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then echo "TEAMCITY_API_ID secret is set"
echo "COOLIFY_TOKEN secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_URL }}" ]]; then
else echo "TEAMCITY_URL secret is empty or missing"
echo "COOLIFY_TOKEN secret is set" exit 1
fi else
if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then echo "TEAMCITY_URL secret is set"
echo "DOCKERHUB_USER secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_USERNAME }}" ]]; then
else echo "TEAMCITY_USERNAME secret is empty or missing"
echo "DOCKERHUB_USER secret is set" exit 1
fi else
if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then echo "TEAMCITY_USERNAME secret is set"
echo "DOCKERHUB_TOKEN secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_PASSWORD }}" ]]; then
else echo "TEAMCITY_PASSWORD secret is empty or missing"
echo "DOCKERHUB_TOKEN secret is set" exit 1
fi else
echo "Current Version: ${{inputs.current_version}}" echo "TEAMCITY_PASSWORD secret is set"
build: fi
needs: check-inputs if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then
if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release' echo "DOCKERHUB_USER secret is empty or missing"
environment: ${{ inputs.environments }} exit 1
runs-on: 'ubuntu-latest' else
permissions: echo "DOCKERHUB_USER secret is set"
contents: read fi
packages: write if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
steps: echo "DOCKERHUB_TOKEN secret is empty or missing"
- name: Branch Checkout exit 1
uses: actions/checkout@v4 else
with: echo "DOCKERHUB_TOKEN secret is set"
ref: ${{ inputs.branch }} fi
- name: Login to Docker echo "Current Version: ${{inputs.current_version}}"
uses: docker/login-action@v3 build:
with: needs: check-inputs
registry: docker.io if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release'
username: ${{ secrets.DOCKERHUB_USER }} environment: ${{ inputs.environments }}
password: ${{ secrets.DOCKERHUB_TOKEN }} runs-on: 'ubuntu-latest'
- name: Docker Build Backend permissions:
run: docker build -f api/Dockerfile -t john4064/shiftsync:prod_api ./api --build-arg ENVIRONMENT=prod contents: read
- name: Docker Push Backend packages: write
run: docker push john4064/shiftsync:prod_api steps:
deploy: - name: Branch Checkout
needs: build uses: actions/checkout@v4
if: needs.build.result == 'success' && inputs.workflow_type == 'release' with:
environment: ${{ inputs.environments }} ref: ${{ inputs.branch }}
runs-on: 'ubuntu-latest' - name: Login to Docker
permissions: uses: docker/login-action@v3
contents: read with:
packages: write registry: docker.io
steps: username: ${{ secrets.DOCKERHUB_USER }}
- name: Deploy to Coolify password: ${{ secrets.DOCKERHUB_TOKEN }}
run: | - name: Docker Build Backend
curl '${{ secrets.COOLIFY_WEBHOOK_API }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}' run: docker build -f api/Dockerfile -t john4064/shiftsync:prod_api ./api --build-arg ENVIRONMENT=prod
- name: Docker Push Backend
run: docker push john4064/shiftsync:prod_api
deploy:
needs: build
if: needs.build.result == 'success' && inputs.workflow_type == 'release'
environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest'
permissions:
contents: read
packages: write
steps:
- name: Deploy to Team City
run: |
curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \
-X POST \
-H "Content-Type: application/json" \
-d '{"buildType": {"id": "${{ secrets.TEAMCITY_API_ID }}"}}' \
"${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue" > /dev/null

View file

@ -1,19 +1,19 @@
name: PR Validation name: PR Validation
on: on:
pull_request: pull_request:
types: [opened] types: [opened]
permissions: permissions:
contents: read contents: read
jobs: jobs:
pr-validation: pr-validation:
permissions: permissions:
contents: read contents: read
pull-requests: write pull-requests: write
runs-on: ['self-hosted', 'pi'] runs-on: 'ubuntu-latest'
steps: steps:
- uses: TimonVS/pr-labeler-action@v5 - uses: TimonVS/pr-labeler-action@v5
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/configs/pr-labeler-configuration.yml configuration-path: .github/configs/pr-labeler-configuration.yml

View file

@ -9,6 +9,8 @@ on:
- reopened - reopened
- synchronize - synchronize
- ready_for_review - ready_for_review
paths:
- web/**
push: push:
branches: branches:
- main - main
@ -16,7 +18,7 @@ on:
- web/** - web/**
jobs: jobs:
determine-workflow: determine-workflow:
runs-on: ['self-hosted','pi'] runs-on: 'ubuntu-latest'
outputs: outputs:
workflow_type: ${{ steps.workflow.outputs.workflow_type }} workflow_type: ${{ steps.workflow.outputs.workflow_type }}
workflow_envs: ${{ steps.workflow.outputs.workflow_envs }} workflow_envs: ${{ steps.workflow.outputs.workflow_envs }}
@ -66,8 +68,10 @@ jobs:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
TEST: ${{ secrets.TEST }} TEST: ${{ secrets.TEST }}
COOLIFY_WEBHOOK_WEB: ${{ secrets.COOLIFY_WEBHOOK_WEB }} TEAMCITY_WEB_ID: ${{ secrets.TEAMCITY_WEB_ID }}
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }} TEAMCITY_URL: ${{ secrets.TEAMCITY_URL }}
TEAMCITY_USERNAME: ${{ secrets.TEAMCITY_USERNAME }}
TEAMCITY_PASSWORD: ${{ secrets.TEAMCITY_PASSWORD }}
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -88,8 +92,10 @@ jobs:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
TEST: ${{ secrets.TEST }} TEST: ${{ secrets.TEST }}
COOLIFY_WEBHOOK_WEB: ${{ secrets.COOLIFY_WEBHOOK_WEB }} TEAMCITY_WEB_ID: ${{ secrets.TEAMCITY_WEB_ID }}
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }} TEAMCITY_URL: ${{ secrets.TEAMCITY_URL }}
TEAMCITY_USERNAME: ${{ secrets.TEAMCITY_USERNAME }}
TEAMCITY_PASSWORD: ${{ secrets.TEAMCITY_PASSWORD }}
permissions: permissions:
contents: read contents: read
packages: write packages: write

View file

@ -1,94 +1,111 @@
name: Web Deployment Non-Production name: Web Deployment Non-Production
on: on:
workflow_call: workflow_call:
inputs: inputs:
environments: environments:
type: string type: string
description: An optional list of environments to deploy to. description: An optional list of environments to deploy to.
default: 'dev' default: 'dev'
workflow_type: workflow_type:
type: string type: string
description: An optional string for workflow types. description: An optional string for workflow types.
default: 'dev' default: 'dev'
branch: branch:
type: string type: string
description: An optional string to define which branch to checkout. description: An optional string to define which branch to checkout.
default: 'main' default: 'main'
current_version: current_version:
type: string type: string
description: Current Version of the package.json. description: Current Version of the package.json.
default: '0.0.0' default: '0.0.0'
secrets: secrets:
DOCKERHUB_USER: {} DOCKERHUB_USER: {}
DOCKERHUB_TOKEN: {} DOCKERHUB_TOKEN: {}
TEST: {} TEST: {}
COOLIFY_WEBHOOK_WEB: {} TEAMCITY_WEB_ID: {}
COOLIFY_TOKEN: {} TEAMCITY_URL: {}
jobs: TEAMCITY_USERNAME: {}
check-inputs: TEAMCITY_PASSWORD: {}
runs-on: 'ubuntu-latest' jobs:
environment: ${{ inputs.environments }} check-inputs:
steps: runs-on: 'ubuntu-latest'
- name: Check secrets present environment: ${{ inputs.environments }}
run: | steps:
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_WEB }}" ]]; then - name: Check secrets present
echo "COOLIFY_WEBHOOK_WEB secret is empty or missing" run: |
exit 1 if [[ -z "${{ secrets.TEAMCITY_WEB_ID }}" ]]; then
else echo "TEAMCITY_WEB_ID secret is empty or missing"
echo "COOLIFY_WEBHOOK_WEB secret is set" exit 1
fi else
if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then echo "TEAMCITY_WEB_ID secret is set"
echo "COOLIFY_TOKEN secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_URL }}" ]]; then
else echo "TEAMCITY_URL secret is empty or missing"
echo "COOLIFY_TOKEN secret is set" exit 1
fi else
if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then echo "TEAMCITY_URL secret is set"
echo "DOCKERHUB_USER secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_USERNAME }}" ]]; then
else echo "TEAMCITY_USERNAME secret is empty or missing"
echo "DOCKERHUB_USER secret is set" exit 1
fi else
if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then echo "TEAMCITY_USERNAME secret is set"
echo "DOCKERHUB_TOKEN secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_PASSWORD }}" ]]; then
else echo "TEAMCITY_PASSWORD secret is empty or missing"
echo "DOCKERHUB_TOKEN secret is set" exit 1
fi else
echo "Current Version: ${{inputs.current_version}}" echo "TEAMCITY_PASSWORD secret is set"
build: fi
needs: check-inputs if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then
if: needs.check-inputs.result == 'success' && inputs.workflow_type != 'release' echo "DOCKERHUB_USER secret is empty or missing"
environment: ${{ inputs.environments }} exit 1
runs-on: 'ubuntu-latest' else
permissions: echo "DOCKERHUB_USER secret is set"
contents: read fi
packages: write if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
steps: echo "DOCKERHUB_TOKEN secret is empty or missing"
- name: Branch Checkout exit 1
uses: actions/checkout@v4 else
with: echo "DOCKERHUB_TOKEN secret is set"
ref: ${{ inputs.branch }} fi
- name: Login to Docker echo "Current Version: ${{inputs.current_version}}"
uses: docker/login-action@v3 build:
with: needs: check-inputs
registry: docker.io if: needs.check-inputs.result == 'success' && inputs.workflow_type != 'release'
username: ${{ secrets.DOCKERHUB_USER }} environment: ${{ inputs.environments }}
password: ${{ secrets.DOCKERHUB_TOKEN }} runs-on: 'ubuntu-latest'
- name: Docker Build Backend permissions:
run: docker build -f web/Dockerfile -t john4064/shiftsync:latest_web ./web --build-arg ENVIRONMENT=dev contents: read
- name: Docker Push Backend packages: write
run: docker push john4064/shiftsync:latest_web steps:
deploy: - name: Branch Checkout
needs: build uses: actions/checkout@v4
if: needs.build.result == 'success' && inputs.workflow_type != 'release' with:
environment: ${{ inputs.environments }} ref: ${{ inputs.branch }}
runs-on: 'ubuntu-latest' - name: Login to Docker
permissions: uses: docker/login-action@v3
contents: read with:
packages: write registry: docker.io
steps: username: ${{ secrets.DOCKERHUB_USER }}
- name: Deploy to Coolify password: ${{ secrets.DOCKERHUB_TOKEN }}
run: | - name: Docker Build Backend
curl '${{ secrets.COOLIFY_WEBHOOK_WEB }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}' run: docker build -f web/Dockerfile -t john4064/shiftsync:latest_web ./web --build-arg ENVIRONMENT=dev
- name: Docker Push Backend
run: docker push john4064/shiftsync:latest_web
deploy:
needs: build
if: needs.build.result == 'success' && inputs.workflow_type != 'release'
environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest'
permissions:
contents: read
packages: write
steps:
- name: Deploy to Team City
run: |
curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \
-X POST \
-H "Content-Type: application/json" \
-d '{"buildType": {"id": "${{ secrets.TEAMCITY_WEB_ID }}"}}' \
"${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue" > /dev/null

View file

@ -1,94 +1,111 @@
name: Web Deployment Production name: Web Deployment Production
on: on:
workflow_call: workflow_call:
inputs: inputs:
environments: environments:
type: string type: string
description: An optional list of environments to deploy to. description: An optional list of environments to deploy to.
default: 'prod' default: 'prod'
workflow_type: workflow_type:
type: string type: string
description: An optional string for workflow types. description: An optional string for workflow types.
default: 'prod' default: 'prod'
branch: branch:
type: string type: string
description: An optional string to define which branch to checkout. description: An optional string to define which branch to checkout.
default: 'main' default: 'main'
current_version: current_version:
type: string type: string
description: Current Version of the package.json. description: Current Version of the package.json.
default: '0.0.0' default: '0.0.0'
secrets: secrets:
DOCKERHUB_USER: {} DOCKERHUB_USER: {}
DOCKERHUB_TOKEN: {} DOCKERHUB_TOKEN: {}
TEST: {} TEST: {}
COOLIFY_WEBHOOK_WEB: {} TEAMCITY_WEB_ID: {}
COOLIFY_TOKEN: {} TEAMCITY_URL: {}
jobs: TEAMCITY_USERNAME: {}
check-inputs: TEAMCITY_PASSWORD: {}
runs-on: 'ubuntu-latest' jobs:
environment: ${{ inputs.environments }} check-inputs:
steps: runs-on: 'ubuntu-latest'
- name: Check secrets present environment: ${{ inputs.environments }}
run: | steps:
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_WEB }}" ]]; then - name: Check secrets present
echo "COOLIFY_WEBHOOK_WEB secret is empty or missing" run: |
exit 1 if [[ -z "${{ secrets.TEAMCITY_WEB_ID }}" ]]; then
else echo "TEAMCITY_WEB_ID secret is empty or missing"
echo "COOLIFY_WEBHOOK_WEB secret is set" exit 1
fi else
if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then echo "TEAMCITY_WEB_ID secret is set"
echo "COOLIFY_TOKEN secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_URL }}" ]]; then
else echo "TEAMCITY_URL secret is empty or missing"
echo "COOLIFY_TOKEN secret is set" exit 1
fi else
if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then echo "TEAMCITY_URL secret is set"
echo "DOCKERHUB_USER secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_USERNAME }}" ]]; then
else echo "TEAMCITY_USERNAME secret is empty or missing"
echo "DOCKERHUB_USER secret is set" exit 1
fi else
if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then echo "TEAMCITY_USERNAME secret is set"
echo "DOCKERHUB_TOKEN secret is empty or missing" fi
exit 1 if [[ -z "${{ secrets.TEAMCITY_PASSWORD }}" ]]; then
else echo "TEAMCITY_PASSWORD secret is empty or missing"
echo "DOCKERHUB_TOKEN secret is set" exit 1
fi else
echo "Current Version: ${{inputs.current_version}}" echo "TEAMCITY_PASSWORD secret is set"
build: fi
needs: check-inputs if [[ -z "${{ secrets.DOCKERHUB_USER }}" ]]; then
if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release' echo "DOCKERHUB_USER secret is empty or missing"
environment: ${{ inputs.environments }} exit 1
runs-on: 'ubuntu-latest' else
permissions: echo "DOCKERHUB_USER secret is set"
contents: read fi
packages: write if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
steps: echo "DOCKERHUB_TOKEN secret is empty or missing"
- name: Branch Checkout exit 1
uses: actions/checkout@v4 else
with: echo "DOCKERHUB_TOKEN secret is set"
ref: ${{ inputs.branch }} fi
- name: Login to Docker echo "Current Version: ${{inputs.current_version}}"
uses: docker/login-action@v3 build:
with: needs: check-inputs
registry: docker.io if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release'
username: ${{ secrets.DOCKERHUB_USER }} environment: ${{ inputs.environments }}
password: ${{ secrets.DOCKERHUB_TOKEN }} runs-on: 'ubuntu-latest'
- name: Docker Build Backend permissions:
run: docker build -f web/Dockerfile -t john4064/shiftsync:prod_web ./web --build-arg ENVIRONMENT=prod contents: read
- name: Docker Push Backend packages: write
run: docker push john4064/shiftsync:prod_web steps:
deploy: - name: Branch Checkout
needs: build uses: actions/checkout@v4
if: needs.build.result == 'success' && inputs.workflow_type == 'release' with:
environment: ${{ inputs.environments }} ref: ${{ inputs.branch }}
runs-on: 'ubuntu-latest' - name: Login to Docker
permissions: uses: docker/login-action@v3
contents: read with:
packages: write registry: docker.io
steps: username: ${{ secrets.DOCKERHUB_USER }}
- name: Deploy to Coolify password: ${{ secrets.DOCKERHUB_TOKEN }}
run: | - name: Docker Build Backend
curl '${{ secrets.COOLIFY_WEBHOOK_WEB }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}' run: docker build -f web/Dockerfile -t john4064/shiftsync:prod_web ./web --build-arg ENVIRONMENT=prod
- name: Docker Push Backend
run: docker push john4064/shiftsync:prod_web
deploy:
needs: build
if: needs.build.result == 'success' && inputs.workflow_type == 'release'
environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest'
permissions:
contents: read
packages: write
steps:
- name: Deploy to Team City
run: |
curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \
-X POST \
-H "Content-Type: application/json" \
-d '{"buildType": {"id": "${{ secrets.TEAMCITY_WEB_ID }}"}}' \
"${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue" > /dev/null

View file

@ -1,14 +1,14 @@
FROM node:20-alpine FROM node:20-alpine
WORKDIR /app WORKDIR /app
COPY ./package*.json ./ COPY ./package*.json ./
RUN npm cache clean --force && npm install --no-audit --no-fund RUN npm ci
COPY . ./ COPY . ./
EXPOSE 5172 EXPOSE 5172
EXPOSE 5170 EXPOSE 5170
CMD npm run dev CMD npm run dev

1403
api/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "shiftsync-website-api", "name": "shiftsync-website-api",
"version": "1.0.1", "version": "1.0.11",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {

View file

@ -1,6 +1,7 @@
import express from 'express'; import express from 'express';
import cors from 'cors'; import cors from 'cors';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
import fs from 'fs/promises';
import { medicationRouter } from './services/medications/index.js'; import { medicationRouter } from './services/medications/index.js';
import { shiftsRouter } from './services/shifts/index.js'; import { shiftsRouter } from './services/shifts/index.js';
import { shiftRunQuery } from './services/shiftConnection.js'; import { shiftRunQuery } from './services/shiftConnection.js';
@ -45,9 +46,12 @@ app.get('/api/db-health', async (req, res) => {
res.status(500).json({ connected: false, error: err.message }); res.status(500).json({ connected: false, error: err.message });
} }
}); });
app.get('/api/version', async (req, res) => { app.get('/api/version', async (req, res) => {
try { try {
res.json('1.0.1'); const packageData = await fs.readFile('./package.json', 'utf8');
const pkg = JSON.parse(packageData);
res.json(pkg.version);
} catch (err) { } catch (err) {
console.error(err); console.error(err);
res.status(500).json({ connected: false, error: err.message }); res.status(500).json({ connected: false, error: err.message });

3040
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,17 +1,17 @@
FROM node:20-alpine FROM node:20-alpine
WORKDIR /app WORKDIR /app
COPY ./package*.json ./ COPY ./package*.json ./
RUN npm cache clean --force && npm install --no-audit --no-fund RUN npm ci
COPY . ./ COPY . ./
EXPOSE 5173 EXPOSE 5173
EXPOSE 5171 EXPOSE 5171
ARG ENVIRONMENT ARG ENVIRONMENT
ENV ENVIRONMENT ${ENVIRONMENT} ENV ENVIRONMENT ${ENVIRONMENT}
CMD npm run ${ENVIRONMENT} CMD npm run ${ENVIRONMENT}

3845
web/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{ {
"name": "shiftsync-website-web", "name": "shiftsync-website-web",
"version": "1.0.10",
"private": true, "private": true,
"version": "1.0.5",
"type": "module", "type": "module",
"scripts": { "scripts": {
"local": "vite", "local": "vite",

View file

@ -14,10 +14,11 @@ export const Home = () => {
}, []); }, []);
return ( return (
<div> <div >
<h1>Home Page</h1> <h1>Home Page</h1>
<Link to="/settings">Go to Settings</Link> <Link to="/settings">Go to Settings</Link>
<p>Version: {pkg.version}</p> <p>Version: {pkg.version}</p>
<p>This site does nothing</p>
</div> </div>
); );
}; };