name: 'Deploy 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 - devspc/devspace-api default: devspc/devspace-apiregistry-core-service namespace: description: 'Name Space' required: true type: choice options: - devx - dev - test - production default: devx 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: 'Print Info' run: | echo "Repository: ${{ github.event.inputs.repo_path }}" echo "Branch: ${{ github.event.inputs.branch }}" echo "Namespace: ${{ github.event.inputs.namespace }}" - name: Cloning 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 to DevSpace continue-on-error: true run: | ./gradlew publishProjectData --no-daemon -x cyclonedxBom - 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" echo 'WORKSPACE: ${{ github.workspace }}' helm upgrade --install "$releaseName" "$pathToHelm" \ --namespace ${{ github.event.inputs.namespace }} \ --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-string 'repository.name=${{ github.event.inputs.repo_path }}' \ --set-string 'repository.branch=${{ github.event.inputs.branch }}' \ --set "imagePullSecrets[0].name=regcred" \ -f ./helms/devspc/stands/values.yaml \ -f ./helms/devspc/stands/${{ github.event.inputs.namespace }}/values.yaml \ --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