mirror of
https://github.com/A6-9V/MQL5-Google-Onedrive.git
synced 2026-04-10 22:30:56 +00:00
94 lines
2.4 KiB
YAML
94 lines
2.4 KiB
YAML
name: Container CI/CD Deployment
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'Dockerfile.mt5'
|
|
- 'scripts/**'
|
|
- '.github/workflows/container-ci-cd.yml'
|
|
workflow_dispatch:
|
|
inputs:
|
|
target:
|
|
description: 'Deployment Target'
|
|
required: true
|
|
default: 'ghcr'
|
|
type: choice
|
|
options:
|
|
- ghcr
|
|
- render
|
|
- railway
|
|
- flyio
|
|
- gcp
|
|
- all
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build-and-push:
|
|
name: Build and Push MT5 Container
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=sha,prefix=mt5-
|
|
type=raw,value=mt5-latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
- name: Build and push MT5 image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.mt5
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
deploy-cloud:
|
|
name: Deploy to Cloud
|
|
needs: build-and-push
|
|
runs-on: ubuntu-latest
|
|
if: github.event.inputs.target != 'ghcr' && github.event.inputs.target != ''
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Run Deployment Script
|
|
run: |
|
|
pip install -r requirements.txt || true
|
|
python scripts/deploy_cloud.py ${{ github.event.inputs.target }}
|
|
env:
|
|
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
|
|
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
|