MQL5-Google-Onedrive/.github/workflows/release.yml
Copilot 3ae9f3f7e7
Add release management infrastructure and automation (#255)
* Initial plan

* Add release infrastructure: CHANGELOG, workflow, and documentation

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>

* Add release checklist and VERSION file

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>

* Fix variable assignment in release preparation script

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>

* Add release quick reference and update documentation

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>

* Add comprehensive release preparation summary

Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>

* Add task completion summary

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mouy-leng <199350297+Mouy-leng@users.noreply.github.com>
2026-02-05 02:53:31 +07:00

208 lines
6.5 KiB
YAML

name: Create Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.21.0)'
required: true
type: string
prerelease:
description: 'Mark as pre-release'
required: false
type: boolean
default: false
permissions:
contents: write
packages: write
jobs:
validate:
name: Validate Repository
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Validate repository structure
run: python3 scripts/ci_validate_repo.py
- name: Validate shell scripts
run: |
bash -n scripts/package_mt5.sh
bash -n scripts/deploy_mt5.sh
package:
name: Build Release Package
needs: validate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Package MT5 files
run: bash scripts/package_mt5.sh
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: Exness_MT5_MQL5
path: dist/Exness_MT5_MQL5.zip
retention-days: 90
- name: Generate checksums
run: |
cd dist
sha256sum Exness_MT5_MQL5.zip > Exness_MT5_MQL5.zip.sha256
cat Exness_MT5_MQL5.zip.sha256
- name: Upload checksums
uses: actions/upload-artifact@v4
with:
name: checksums
path: dist/*.sha256
retention-days: 90
build-docker:
name: Build Docker Images
needs: validate
runs-on: ubuntu-latest
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: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
create-release:
name: Create GitHub Release
needs: [validate, package, build-docker]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: Exness_MT5_MQL5
path: ./dist
- name: Download checksums
uses: actions/download-artifact@v4
with:
name: checksums
path: ./dist
- name: Extract version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Extract changelog
id: changelog
run: |
VERSION="${{ steps.version.outputs.version }}"
VERSION_NO_V="${VERSION#v}"
# Extract changelog section for this version
if [ -f CHANGELOG.md ]; then
awk "/## \[${VERSION_NO_V}\]/,/## \[/{if(/## \[${VERSION_NO_V}\]/)f=1;else if(/## \[/)exit;if(f)print}" CHANGELOG.md > release_notes.md
# If empty, use a default message
if [ ! -s release_notes.md ]; then
echo "Release ${VERSION}" > release_notes.md
echo "" >> release_notes.md
echo "See [CHANGELOG.md](CHANGELOG.md) for details." >> release_notes.md
fi
else
echo "Release ${VERSION}" > release_notes.md
echo "" >> release_notes.md
echo "MQL5 SMC + Trend Breakout Trading System" >> release_notes.md
fi
- name: Display release notes
run: cat release_notes.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.version }}
name: Release ${{ steps.version.outputs.version }}
body_path: release_notes.md
draft: false
prerelease: ${{ github.event.inputs.prerelease || false }}
files: |
dist/Exness_MT5_MQL5.zip
dist/Exness_MT5_MQL5.zip.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
run: |
echo "## Release Created Successfully! 🎉" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Release Assets" >> $GITHUB_STEP_SUMMARY
echo "- MT5 Package: \`Exness_MT5_MQL5.zip\`" >> $GITHUB_STEP_SUMMARY
echo "- Checksums: \`Exness_MT5_MQL5.zip.sha256\`" >> $GITHUB_STEP_SUMMARY
echo "- Docker Image: \`ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Installation" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
echo "# Download and extract" >> $GITHUB_STEP_SUMMARY
echo "wget https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/Exness_MT5_MQL5.zip" >> $GITHUB_STEP_SUMMARY
echo "unzip Exness_MT5_MQL5.zip -d /path/to/MT5/MQL5" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "# Or use Docker" >> $GITHUB_STEP_SUMMARY
echo "docker pull ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY