Test deploy #31

Merged
John4064 merged 50 commits from test-deploy into main 2026-03-04 05:20:21 +00:00
8 changed files with 199 additions and 197 deletions
Showing only changes of commit d03e81c939 - Show all commits

View file

@ -18,7 +18,7 @@ on:
- api/** - api/**
jobs: jobs:
determine-workflow: determine-workflow:
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
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 }}
@ -45,6 +45,8 @@ jobs:
echo "workflow_envs=$workflow_envs" >> $GITHUB_OUTPUT echo "workflow_envs=$workflow_envs" >> $GITHUB_OUTPUT
echo "Running $workflow_type pipeline in environments: $workflow_envs" >> $GITHUB_STEP_SUMMARY echo "Running $workflow_type pipeline in environments: $workflow_envs" >> $GITHUB_STEP_SUMMARY
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Extract Version - name: Extract Version
id: version id: version
shell: bash shell: bash

View file

@ -26,7 +26,7 @@ on:
COOLIFY_TOKEN: {} COOLIFY_TOKEN: {}
jobs: jobs:
check-inputs: check-inputs:
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
steps: steps:
- name: Check secrets present - name: Check secrets present
@ -60,7 +60,7 @@ jobs:
needs: check-inputs needs: check-inputs
if: needs.check-inputs.result == 'success' && inputs.workflow_type != 'release' if: needs.check-inputs.result == 'success' && inputs.workflow_type != 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -83,7 +83,7 @@ jobs:
needs: build needs: build
if: needs.build.result == 'success' && inputs.workflow_type != 'release' if: needs.build.result == 'success' && inputs.workflow_type != 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write

View file

@ -26,7 +26,7 @@ on:
COOLIFY_TOKEN: {} COOLIFY_TOKEN: {}
jobs: jobs:
check-inputs: check-inputs:
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
steps: steps:
- name: Check secrets present - name: Check secrets present
@ -60,7 +60,7 @@ jobs:
needs: check-inputs needs: check-inputs
if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release' if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -83,7 +83,7 @@ jobs:
needs: build needs: build
if: needs.build.result == 'success' && inputs.workflow_type == 'release' if: needs.build.result == 'success' && inputs.workflow_type == 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write

View file

@ -45,6 +45,8 @@ jobs:
echo "workflow_envs=$workflow_envs" >> $GITHUB_OUTPUT echo "workflow_envs=$workflow_envs" >> $GITHUB_OUTPUT
echo "Running $workflow_type pipeline in environments: $workflow_envs" >> $GITHUB_STEP_SUMMARY echo "Running $workflow_type pipeline in environments: $workflow_envs" >> $GITHUB_STEP_SUMMARY
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Extract Version - name: Extract Version
id: version id: version
shell: bash shell: bash

View file

@ -1,94 +1,93 @@
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: {} COOLIFY_WEBHOOK_WEB: {}
COOLIFY_TOKEN: {} COOLIFY_TOKEN: {}
jobs: jobs:
check-inputs: check-inputs:
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
steps: steps:
- name: Check secrets present - name: Check secrets present
run: | run: |
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_WEB }}" ]]; then if [[ -z "${{ secrets.COOLIFY_WEBHOOK_WEB }}" ]]; then
echo "COOLIFY_WEBHOOK_WEB secret is empty or missing" echo "COOLIFY_WEBHOOK_WEB secret is empty or missing"
exit 1 exit 1
else else
echo "COOLIFY_WEBHOOK_WEB secret is set" echo "COOLIFY_WEBHOOK_WEB secret is set"
fi fi
if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then
echo "COOLIFY_TOKEN secret is empty or missing" echo "COOLIFY_TOKEN secret is empty or missing"
exit 1 exit 1
else else
echo "COOLIFY_TOKEN secret is set" echo "COOLIFY_TOKEN 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"
exit 1 exit 1
else else
echo "DOCKERHUB_USER secret is set" echo "DOCKERHUB_USER secret is set"
fi fi
if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
echo "DOCKERHUB_TOKEN secret is empty or missing" echo "DOCKERHUB_TOKEN secret is empty or missing"
exit 1 exit 1
else else
echo "DOCKERHUB_TOKEN secret is set" echo "DOCKERHUB_TOKEN secret is set"
fi fi
echo "Current Version: ${{inputs.current_version}}" echo "Current Version: ${{inputs.current_version}}"
build: build:
needs: check-inputs needs: check-inputs
if: needs.check-inputs.result == 'success' && inputs.workflow_type != 'release' if: needs.check-inputs.result == 'success' && inputs.workflow_type != 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write
steps: steps:
- name: Branch Checkout - name: Branch Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: ${{ inputs.branch }} ref: ${{ inputs.branch }}
- name: Login to Docker - name: Login to Docker
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: docker.io registry: docker.io
username: ${{ secrets.DOCKERHUB_USER }} username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build Backend - name: Docker Build Backend
run: docker build -f web/Dockerfile -t john4064/shiftsync:latest_web ./web --build-arg ENVIRONMENT=dev run: docker build -f web/Dockerfile -t john4064/shiftsync:latest_web ./web --build-arg ENVIRONMENT=dev
- name: Docker Push Backend - name: Docker Push Backend
run: docker push john4064/shiftsync:latest_web run: docker push john4064/shiftsync:latest_web
deploy: deploy:
needs: build needs: build
if: needs.build.result == 'success' && inputs.workflow_type != 'release' if: needs.build.result == 'success' && inputs.workflow_type != 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write
steps: steps:
- name: Deploy to Coolify - name: Deploy to Coolify
run: | run: |
curl --request GET '${{ secrets.COOLIFY_WEBHOOK_WEB }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}' curl -X GET '${{ secrets.COOLIFY_WEBHOOK_WEB }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'

View file

@ -1,94 +1,93 @@
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: {} COOLIFY_WEBHOOK_WEB: {}
COOLIFY_TOKEN: {} COOLIFY_TOKEN: {}
jobs: jobs:
check-inputs: check-inputs:
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
steps: steps:
- name: Check secrets present - name: Check secrets present
run: | run: |
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_WEB }}" ]]; then if [[ -z "${{ secrets.COOLIFY_WEBHOOK_WEB }}" ]]; then
echo "COOLIFY_WEBHOOK_WEB secret is empty or missing" echo "COOLIFY_WEBHOOK_WEB secret is empty or missing"
exit 1 exit 1
else else
echo "COOLIFY_WEBHOOK_WEB secret is set" echo "COOLIFY_WEBHOOK_WEB secret is set"
fi fi
if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then if [[ -z "${{ secrets.COOLIFY_TOKEN }}" ]]; then
echo "COOLIFY_TOKEN secret is empty or missing" echo "COOLIFY_TOKEN secret is empty or missing"
exit 1 exit 1
else else
echo "COOLIFY_TOKEN secret is set" echo "COOLIFY_TOKEN 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"
exit 1 exit 1
else else
echo "DOCKERHUB_USER secret is set" echo "DOCKERHUB_USER secret is set"
fi fi
if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then if [[ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]]; then
echo "DOCKERHUB_TOKEN secret is empty or missing" echo "DOCKERHUB_TOKEN secret is empty or missing"
exit 1 exit 1
else else
echo "DOCKERHUB_TOKEN secret is set" echo "DOCKERHUB_TOKEN secret is set"
fi fi
echo "Current Version: ${{inputs.current_version}}" echo "Current Version: ${{inputs.current_version}}"
build: build:
needs: check-inputs needs: check-inputs
if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release' if: needs.check-inputs.result == 'success' && inputs.workflow_type == 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write
steps: steps:
- name: Branch Checkout - name: Branch Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: ${{ inputs.branch }} ref: ${{ inputs.branch }}
- name: Login to Docker - name: Login to Docker
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: docker.io registry: docker.io
username: ${{ secrets.DOCKERHUB_USER }} username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build Backend - name: Docker Build Backend
run: docker build -f web/Dockerfile -t john4064/shiftsync:prod_web ./web --build-arg ENVIRONMENT=prod run: docker build -f web/Dockerfile -t john4064/shiftsync:prod_web ./web --build-arg ENVIRONMENT=prod
- name: Docker Push Backend - name: Docker Push Backend
run: docker push john4064/shiftsync:prod_web run: docker push john4064/shiftsync:prod_web
deploy: deploy:
needs: build needs: build
if: needs.build.result == 'success' && inputs.workflow_type == 'release' if: needs.build.result == 'success' && inputs.workflow_type == 'release'
environment: ${{ inputs.environments }} environment: ${{ inputs.environments }}
runs-on: 'ubuntu-latest' runs-on: ['self-hosted','pi']
permissions: permissions:
contents: read contents: read
packages: write packages: write
steps: steps:
- name: Deploy to Coolify - name: Deploy to Coolify
run: | run: |
curl --request GET '${{ secrets.COOLIFY_WEBHOOK_WEB }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}' curl -X GET '${{ secrets.COOLIFY_WEBHOOK_WEB }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'

View file

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

View file

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