82 lines
2.7 KiB
YAML
82 lines
2.7 KiB
YAML
name: 'Build Backend'
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
repo_path:
|
|
description: 'Репозиторий'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- devspc/devspace-apiregistry-core-service
|
|
- devspc/devspace-apiregistry-generator-service
|
|
- devspc/devspace-gateway
|
|
default: devspc/devspace-apiregistry-core-service
|
|
branch:
|
|
description: 'Ветка'
|
|
required: true
|
|
type: string
|
|
default: master
|
|
version:
|
|
default: latest
|
|
description: 'Версия образа'
|
|
required: true
|
|
type: string
|
|
jobs:
|
|
deploy-dev:
|
|
name: 'Deploy to dev'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Cloning2
|
|
uses: https://git.binom.pw/otp/devops/clone@main
|
|
with:
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
repository: ${{ github.event.inputs.repo_path }}
|
|
branch: ${{ github.event.inputs.branch }}
|
|
- uses: https://git.binom.pw/otp/devops/config-gradle@main
|
|
- uses: https://git.binom.pw/otp/devops/setup-gradle@main
|
|
- name: Setup Jvm
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: 21
|
|
distribution: "adopt"
|
|
- name: Building
|
|
run: |
|
|
./gradlew bootJar --no-daemon -x cyclonedxBom
|
|
echo 'Jar in libs folder'
|
|
ls ./build/libs
|
|
- name: Publishing docker
|
|
uses: https://git.binom.pw/otp/devops/docker@main
|
|
with:
|
|
image-name: "otp/${{ github.event.inputs.repo_path }}"
|
|
tags: ${{ github.event.inputs.version }}
|
|
- name: Kuebrnetus config
|
|
run: |
|
|
echo '${{ secrets.KUBE_CONFIG }}' > ./ku.yaml
|
|
- name: "Install Helm"
|
|
uses: azure/setup-helm@v4.3.0
|
|
- name: 'Clone Helms'
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
repository: otp/devex
|
|
path: 'helms'
|
|
- name: Deploy
|
|
run: |
|
|
pathToHelm='./helms/${{ github.event.inputs.repo_path }}'
|
|
releaseName=$(basename "$pathToHelm")
|
|
echo "Release Name: $releaseName"
|
|
helm upgrade --install "$releaseName" "$pathToHelm" \
|
|
--namespace devx \
|
|
--kubeconfig ./ku.yaml \
|
|
--create-namespace \
|
|
--set-string 'image.version=${{ github.event.inputs.version }}' \
|
|
--set-string 'image.name=images.binom.pw/otp/${{ github.event.inputs.repo_path }}' \
|
|
--set "imagePullSecrets[0].name=regcred" \
|
|
--wait
|
|
- name: 'Cleanup'
|
|
if: always()
|
|
shell: bash
|
|
run: |
|
|
echo 'Cleaning...'
|
|
rm -rf ~/.gradle/init.gradle.kts
|
|
rm -rf ~/.ssh/config
|
|
rm -rf ~/.ssh/my_key |