Test deploy #31

Merged
John4064 merged 50 commits from test-deploy into main 2026-03-04 05:20:21 +00:00
3 changed files with 100 additions and 96 deletions
Showing only changes of commit 9847a7271e - Show all commits

View file

@ -1,95 +1,97 @@
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: COOLIFY_WEBHOOK_API: ${{ secrets.COOLIFY_WEBHOOK_API }}
contents: read COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}
packages: write permissions:
prod-deploy: contents: read
needs: determine-workflow packages: write
if: needs.determine-workflow.outputs.workflow_type == 'release' prod-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-prod.yml matrix:
with: env: ${{ fromJson(needs.determine-workflow.outputs.workflow_envs) }}
environments: ${{ matrix.env }} uses: ./.github/workflows/api-deploy-prod.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: COOLIFY_WEBHOOK_API: ${{ secrets.COOLIFY_WEBHOOK_API }}
contents: read COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}
packages: write permissions:
contents: read
packages: write

View file

@ -90,5 +90,5 @@ jobs:
steps: steps:
- name: Deploy to Coolify - name: Deploy to Coolify
run: | run: |
curl -X --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 }}'

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