name: Deploy Applications on: push: branches: [ main, master ] workflow_run: workflows: ["Backend CI", "Web App CI"] types: - completed jobs: deploy-backend: if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Download backend artifact if: github.event_name == 'workflow_run' uses: actions/download-artifact@v4 with: name: backend-binary path: mnemo_cards_backend/ - 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: | chmod +x mnemo_cards_backend/build_app.sh ./mnemo_cards_backend/build_app.sh deploy-web: if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Download web artifact if: github.event_name == 'workflow_run' uses: actions/download-artifact@v4 with: name: web-build path: mnemo_cards_web_v2/build/web/ - 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 mnemo_cards_web_v2 chmod +x deploy/deploy.sh ./deploy/deploy.sh deploy-mobile: if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Download Android APK uses: actions/download-artifact@v4 with: name: android-apk path: ./artifacts/ - name: Download iOS build uses: actions/download-artifact@v4 with: name: ios-build path: ./artifacts/ios/ - name: Create GitHub release uses: softprops/action-gh-release@v2 with: files: | ./artifacts/app-release.apk generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}