mnemo_cards/tools/ci/cd-deploy.yml

93 lines
2.3 KiB
YAML
Raw Normal View History

2025-11-16 12:15:21 +00:00
name: Deploy Applications
on:
push:
branches: [ main, master ]
workflow_dispatch:
inputs:
component:
description: 'Component to deploy'
required: false
default: 'all'
type: choice
options:
- all
- backend
- web
- mobile
2025-11-16 12:15:21 +00:00
jobs:
deploy-backend:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch'
2025-11-16 12:15:21 +00:00
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup SSH
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
- name: Add server to known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H 147.45.152.129 >> ~/.ssh/known_hosts
- name: Deploy backend
run: |
2025-11-16 14:05:47 +00:00
cd tools/deploy
chmod +x backend-build_app.sh
./backend-build_app.sh
2025-11-16 12:15:21 +00:00
deploy-web:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event_name == 'workflow_dispatch'
2025-11-16 12:15:21 +00:00
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup SSH
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
- name: Add server to known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H 147.45.152.129 >> ~/.ssh/known_hosts
- name: Deploy web app
run: |
2025-11-16 14:05:47 +00:00
cd tools/deploy/web-app
chmod +x deploy.sh
./deploy.sh
2025-11-16 12:15:21 +00:00
deploy-mobile:
2025-11-16 14:05:47 +00:00
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
2025-11-16 12:15:21 +00:00
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
2025-11-16 14:05:47 +00:00
- name: Create release notes
run: |
echo "🚀 New release from $(date)" > release_notes.md
echo "" >> release_notes.md
echo "## Changes" >> release_notes.md
git log --oneline -10 >> release_notes.md
2025-11-16 12:15:21 +00:00
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
2025-11-16 14:05:47 +00:00
tag_name: v$(date +%Y%m%d_%H%M%S)
name: "Release $(date +%Y-%m-%d)"
body_path: release_notes.md
draft: false
prerelease: false
2025-11-16 12:15:21 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}