67 lines
1.7 KiB
YAML
67 lines
1.7 KiB
YAML
name: Deploy Project
|
|
|
|
inputs:
|
|
Version:
|
|
description: application version that you are deploying
|
|
required: true
|
|
# GITHUB_TOKEN:
|
|
# description: token used to call workflow
|
|
# required: true
|
|
Branch:
|
|
description: github branch where CD workflow is supposed to run
|
|
required: false
|
|
default: develop
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
branches:
|
|
- develop
|
|
paths-ignore:
|
|
- 'README.md'
|
|
# - '.github/**'
|
|
# inputs:
|
|
# Version:
|
|
# description: Application Version
|
|
# type: string
|
|
# required: true
|
|
# Env:
|
|
# description: Deployment Environment
|
|
# type: environment
|
|
# required: true
|
|
|
|
jobs:
|
|
# on-success:
|
|
# runs-on: ubuntu-latest
|
|
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
# steps:
|
|
# - run: echo "First workflow was a success"
|
|
|
|
# on-failure:
|
|
# runs-on: ubuntu-latest
|
|
# if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
|
# steps:
|
|
# - run: echo "First workflow was a failure"
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup SSH
|
|
shell: bash
|
|
run: |
|
|
whoami
|
|
eval `ssh-agent -s`
|
|
mkdir -p ~/.ssh/
|
|
touch ~/.ssh/id_rsa
|
|
echo "${{secrets.SSH_KEY}}" | tr -d '\r' > ~/.ssh/id_rsa
|
|
chmod 700 ~/.ssh/id_rsa
|
|
ssh-keyscan -t rsa,dsa,ecdsa,ed25519 ${{secrets.SSH_HOST}} >> ~/.ssh/known_hosts
|
|
chmod 644 ~/.ssh/known_hosts
|
|
|
|
- name: SSH to the Prod env
|
|
shell: bash
|
|
run: |
|
|
ssh -tt -o StrictHostKeyChecking=no gitea@${{secrets.SSH_HOST}} 'whoami'
|
|
|