Skip to content

Main Workflow

Main Workflow #36

Workflow file for this run

name: Main Workflow
on:
push:
paths:
- "backend/**"
- "frontend/**"
- "devops/stacks/*"
- ".github/workflows/backend.yml"
- ".github/workflows/frontend.yml"
workflow_dispatch:
jobs:
config:
runs-on: ubuntu-latest
outputs:
ENVIRONMENT: ${{ steps.vars.outputs.ENVIRONMENT }}
STACK_NAME: ${{ steps.vars.outputs.STACK_NAME }}
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Env Vars
id: vars
run: |
ENVIRONMENT=${{ vars.LIVE_ENV }}
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_OUTPUT
echo "STACK_NAME=${ENVIRONMENT//./-}" >> $GITHUB_OUTPUT
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend:
- 'backend/**'
- '.github/workflows/backend.yml'
frontend:
- 'frontend/**'
- '.github/workflows/frontend.yml'
backend:
uses: ./.github/workflows/backend.yml
needs:
- config
if: ${{ needs.config.outputs.backend == 'true' }}
permissions:
contents: read
packages: write
frontend:
uses: ./.github/workflows/frontend.yml
needs:
- config
if: ${{ needs.config.outputs.frontend == 'true' }}
permissions:
contents: read
packages: write
deploy:
if: ${{ always() && github.ref == 'refs/heads/main' && !contains(needs.*.result, 'failure') }}
needs:
- config
- backend
- frontend
runs-on: ubuntu-latest
environment: ${{ needs.config.outputs.ENVIRONMENT }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to cluster
uses: kitconcept/[email protected]
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_private_key: ${{ secrets.DEPLOY_SSH }}
stack_file: devops/stacks/${{ needs.config.outputs.ENVIRONMENT }}.yml
stack_name: ${{ needs.config.outputs.STACK_NAME }}
stack_param: ${{ github.ref_name }}
env_file: ${{ secrets.ENV_FILE }}
deploy_timeout: 480