Fix prod/nonprod
This commit is contained in:
parent
1fc6b5a30c
commit
1f3bbc8d40
2 changed files with 93 additions and 95 deletions
1
.github/workflows/api-deploy-nonprod.yml
vendored
1
.github/workflows/api-deploy-nonprod.yml
vendored
|
|
@ -91,4 +91,3 @@ jobs:
|
||||||
- name: Deploy to Coolify
|
- name: Deploy to Coolify
|
||||||
run: |
|
run: |
|
||||||
curl -X GET '${{ secrets.COOLIFY_WEBHOOK_API }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'
|
curl -X GET '${{ secrets.COOLIFY_WEBHOOK_API }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'
|
||||||
|
|
||||||
|
|
|
||||||
187
.github/workflows/api-deploy-prod.yml
vendored
187
.github/workflows/api-deploy-prod.yml
vendored
|
|
@ -1,94 +1,93 @@
|
||||||
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: {}
|
COOLIFY_WEBHOOK_API: {}
|
||||||
COOLIFY_TOKEN: {}
|
COOLIFY_TOKEN: {}
|
||||||
jobs:
|
jobs:
|
||||||
check-inputs:
|
check-inputs:
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
environment: ${{ inputs.environments }}
|
environment: ${{ inputs.environments }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check secrets present
|
- name: Check secrets present
|
||||||
run: |
|
run: |
|
||||||
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_API }}" ]]; then
|
if [[ -z "${{ secrets.COOLIFY_WEBHOOK_API }}" ]]; then
|
||||||
echo "COOLIFY_WEBHOOK_API secret is empty or missing"
|
echo "COOLIFY_WEBHOOK_API secret is empty or missing"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "COOLIFY_WEBHOOK_API secret is set"
|
echo "COOLIFY_WEBHOOK_API 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: 'ubuntu-latest'
|
||||||
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 api/Dockerfile -t john4064/shiftsync:prod_api ./api --build-arg ENVIRONMENT=prod
|
run: docker build -f api/Dockerfile -t john4064/shiftsync:prod_api ./api --build-arg ENVIRONMENT=prod
|
||||||
- name: Docker Push Backend
|
- name: Docker Push Backend
|
||||||
run: docker push john4064/shiftsync:prod_api
|
run: docker push john4064/shiftsync:prod_api
|
||||||
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: 'ubuntu-latest'
|
||||||
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_API }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'
|
curl -X GET '${{ secrets.COOLIFY_WEBHOOK_API }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue