37 lines
1.6 KiB
YAML
37 lines
1.6 KiB
YAML
# This is the main CI/CD workflow for the cms-api application.
|
|
# It triggers on pushes of tags matching semantic versioning with environment suffixes.
|
|
|
|
name: CI/CD for project
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*' # Matches v-prefixed tags like v1.0.0, v1.0.0-dev.1, v1.0.0-stg.1
|
|
|
|
jobs:
|
|
# This job calls the reusable deployment workflow.
|
|
deploy_service:
|
|
# Set the environment name based on the Git tag
|
|
environment: ${{ (contains(github.ref_name, '-dev.')) && 'development' || (contains(github.ref_name, '-stg.')) && 'staging' || 'production' }}
|
|
|
|
uses: devops/ansible-gitea/.gitea/workflows/deploy.yml@main
|
|
|
|
# Provide the specific inputs for this application.
|
|
with:
|
|
app_name: ${{ github.event.repository.name }}
|
|
deploy_env: ${{ (contains(github.ref_name, '-dev.')) && 'development' || (contains(github.ref_name, '-stg.')) && 'staging' || 'production' }}
|
|
env_type: ${{ (contains(github.ref_name, 'worker')) && 'worker' || '' }}
|
|
|
|
# Pass the required secrets to the reusable workflow.
|
|
# These secrets must be configured in the Gitea settings for this repository.
|
|
secrets:
|
|
SERVER_HOST: ${{ secrets.SERVER_HOST }}
|
|
SERVER_PORT: ${{ secrets.SERVER_PORT }}
|
|
SERVER_USER: ${{ secrets.SERVER_USER }}
|
|
SERVER_SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PRIVATE_KEY }}
|
|
SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }}
|
|
VAULT_PASSWORD: ${{ secrets.VAULT_PASSWORD }}
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|