75 lines
2.2 KiB
YAML
75 lines
2.2 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
required: false
|
|
type: string
|
|
default: latest
|
|
debug:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
migrate:
|
|
type: boolean
|
|
default: false
|
|
build:
|
|
type: boolean
|
|
default: false
|
|
environment:
|
|
type: string
|
|
required: true
|
|
host:
|
|
type: string
|
|
required: true
|
|
name:
|
|
type: string
|
|
required: false
|
|
option:
|
|
type: string
|
|
required: false
|
|
tests:
|
|
type: string
|
|
default: true
|
|
vault:
|
|
type: string
|
|
default: true
|
|
|
|
jobs:
|
|
deploy:
|
|
if: ${{ contains(format(',{0},', vars.ADMIN_USERS), format(',{0},', github.actor)) || startsWith(inputs.environment, 'stage') }}
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CR_REGISTRY: crp8vh46gd976oq8ipla
|
|
CR_REPO: ${{ github.event.repository.name }}
|
|
TAG: ${{ inputs.tag }}
|
|
steps:
|
|
- name: notify
|
|
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
|
env:
|
|
VK_TEAMS_BOT_TOKEN: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
|
|
VK_TEAMS_CHAT_ID: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
|
with:
|
|
result: 'started'
|
|
name: deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|
|
- name: deploy
|
|
id: k8s_deploy
|
|
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/k8s@HEAD
|
|
with:
|
|
secrets: ${{ toJSON(secrets) }}
|
|
environment: ${{ inputs.environment }}
|
|
tag: ${{ inputs.tag }}
|
|
migrate: ${{ inputs.migrate }}
|
|
appName: ${{ inputs.name || github.event.repository.name }}
|
|
optionName: ${{ inputs.option || format('images.{0}', github.event.repository.name) }}
|
|
tests: ${{ inputs.tests }}
|
|
vault: ${{ inputs.vault }}
|
|
- name: post-notify
|
|
if: always()
|
|
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/vk-notify@main
|
|
env:
|
|
VK_TEAMS_BOT_TOKEN: ${{ secrets.VK_TEAMS_BOT_TOKEN }}
|
|
VK_TEAMS_CHAT_ID: ${{ secrets.VK_TEAMS_CHAT_ID }}
|
|
with:
|
|
result: ${{ steps.k8s_deploy.outcome }}
|
|
name: deploy ${{ inputs.environment }} tag ${{ inputs.tag }}
|