80 lines
2 KiB
YAML
80 lines
2 KiB
YAML
name: Deploy Applications
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
|
|
jobs:
|
|
deploy-backend:
|
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
|
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: |
|
|
cd tools/deploy
|
|
chmod +x backend-build_app.sh
|
|
./backend-build_app.sh
|
|
|
|
deploy-web:
|
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
|
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: |
|
|
cd tools/deploy/web-app
|
|
chmod +x deploy.sh
|
|
./deploy.sh
|
|
|
|
deploy-mobile:
|
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- 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
|
|
|
|
- name: Create GitHub release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
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
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|