43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
name: 'Deploy on push'
|
||
on: [push]
|
||
|
||
jobs:
|
||
deploy:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Cloning repo
|
||
uses: actions/checkout@v4
|
||
with:
|
||
fetch-depth: 0
|
||
|
||
- name: Get Repo Name
|
||
id: repo_name
|
||
run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})"
|
||
|
||
- name: Get Branch Name
|
||
id: branch_name
|
||
run: echo "::set-output name=branch::$(echo ${GITHUB_REF##*/})"
|
||
|
||
- name: Push to dokku for main branch
|
||
if: github.ref == 'refs/heads/main'
|
||
uses: dokku/github-action@master
|
||
with:
|
||
branch: 'main'
|
||
git_remote_url: 'ssh://dokku@v2.discours.io:22/discoursio-api'
|
||
ssh_private_key: ${{ secrets.PROD_PRIVATE_KEY }}
|
||
|
||
|
||
- name: Push to dokku for main branch
|
||
if: github.ref == 'refs/heads/main'
|
||
run: |
|
||
# Настройка Git
|
||
git config --global user.email "ci@dev.discours.io"
|
||
git config --global user.name "CI Bot"
|
||
|
||
# Добавление удаленного репозитория Dokku
|
||
git remote add dokku ssh://dokku@staging.discours.io:22/core
|
||
|
||
# Push с отключением проверки хоста
|
||
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
|
||
git push -f dokku main --force
|