add: CI
This commit is contained in:
@@ -1,39 +1,33 @@
|
|||||||
name: Deploy via SSH on push
|
name: Deploy via SSH on push
|
||||||
run-name: ${{ gitea.actor }} is deploying via SSH
|
run-name: ${{ gitea.actor }} is deploying via SSH
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-via-ssh:
|
deploy-via-ssh:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: echo "The job was triggered by a ${{ gitea.event_name }} event."
|
- run: echo "The job was triggered by a ${{ gitea.event_name }} event."
|
||||||
- run: echo "Branch: ${{ gitea.ref }}, Repository: ${{ gitea.repository }}"
|
- run: echo "Branch ${{ gitea.ref }}, Repository ${{ gitea.repository }}"
|
||||||
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- run: echo "Repository ${{ gitea.repository }} has been cloned to the runner."
|
- run: echo "Repository ${{ gitea.repository }} has been cloned to the runner."
|
||||||
|
|
||||||
- name: Install SSH client and Git
|
- name: Install SSH client and Git
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y openssh-client git
|
sudo apt-get install -y openssh-client git
|
||||||
|
|
||||||
- name: Configure SSH
|
- name: Configure SSH
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${{ gitea.secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
echo "${{ gitea.secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
echo -e "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
|
echo -e "Host *\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
|
||||||
|
|
||||||
- name: Deploy via SSH
|
- name: Deploy via SSH
|
||||||
run: |
|
run: >
|
||||||
echo "Connecting to ${{ gitea.secrets.SSH_USER }}@${{ gitea.secrets.SSH_HOST }} to deploy..."
|
echo "Connecting to ${{ gitea.secrets.SSH_USER }}@${{
|
||||||
|
gitea.secrets.SSH_HOST }} to deploy..."
|
||||||
|
|
||||||
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
|
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
|
||||||
cd /path/to/your/project
|
cd /path/to/your/project
|
||||||
echo "Pulling latest changes from main..."
|
echo "Pulling latest changes from main..."
|
||||||
@@ -43,5 +37,4 @@ jobs:
|
|||||||
docker-compose up -d --build
|
docker-compose up -d --build
|
||||||
echo "Deployment completed!"
|
echo "Deployment completed!"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- run: echo "The deployment job has finished with status ${{ job.status }}."
|
- run: echo "The deployment job has finished with status ${{ job.status }}."
|
||||||
|
|||||||
Reference in New Issue
Block a user