86 lines
2.9 KiB
YAML
86 lines
2.9 KiB
YAML
name: 'Build Backend'
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
repo_path:
|
|
description: 'Репозиторий'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- devspc/devspace-apiregistry-generator-service
|
|
- devspc/devspace-gateway
|
|
- devspc/devspace-apiregistry-core-service
|
|
default: devspc/devspace-apiregistry-generator-service
|
|
branch:
|
|
description: 'Ветка'
|
|
required: true
|
|
type: string
|
|
default: master
|
|
version:
|
|
description: 'Версия образа'
|
|
required: true
|
|
type: number
|
|
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: Update Helm version
|
|
shell: bash
|
|
run: |
|
|
pwd
|
|
echo 'Dir: ./helms/devspc/devspace-apiregistry-core-service'
|
|
ls -la ./helms/devspc/devspace-apiregistry-core-service
|
|
echo './helms/${{ github.event.inputs.repo_path }}'
|
|
ls -la ./helms/${{ github.event.inputs.repo_path }}
|
|
sed -i -e 's/9.9.9/${{ github.event.inputs.number }}/g' ./helms/${{ github.event.inputs.repo_path }}/Chart.yaml
|
|
echo 'Result Helm Chart:'
|
|
cat ${{ inputs.chart_directory }}/Chart.yaml
|
|
- name: Deploy
|
|
run: |
|
|
helm upgrade --install devspace-apiregistry-core ./helms/${{ github.event.inputs.repo_path }} \
|
|
--namespace devx \
|
|
--kubeconfig ./ku.yaml \
|
|
--create-namespace \
|
|
--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 |