mirror of
https://github.com/zhigang1992/telegram-mcp.git
synced 2026-06-12 23:48:58 +08:00
95 lines
2.6 KiB
YAML
95 lines
2.6 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: linux-x64
|
|
build_name: telegram-mcp-linux-x64
|
|
- os: macos-latest
|
|
target: darwin-x64
|
|
build_name: telegram-mcp-darwin-x64
|
|
- os: macos-latest
|
|
target: darwin-arm64
|
|
build_name: telegram-mcp-darwin-arm64
|
|
- os: windows-latest
|
|
target: win-x64
|
|
build_name: telegram-mcp-win-x64.exe
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Build executable
|
|
run: |
|
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
|
bun build ./src/main.ts --compile --outfile ${{ matrix.build_name }} --target=bun-${{ matrix.target }}
|
|
else
|
|
bun build ./src/main.ts --compile --outfile ${{ matrix.build_name }} --target=bun-${{ matrix.target }}
|
|
fi
|
|
shell: bash
|
|
|
|
- name: Create tarball (Unix)
|
|
if: matrix.os != 'windows-latest'
|
|
run: tar -czf ${{ matrix.build_name }}.tar.gz ${{ matrix.build_name }} README.md
|
|
|
|
- name: Create zip (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
run: |
|
|
Compress-Archive -Path ${{ matrix.build_name }}, README.md -DestinationPath ${{ matrix.build_name }}.zip
|
|
shell: pwsh
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.build_name }}
|
|
path: |
|
|
${{ matrix.build_name }}.tar.gz
|
|
${{ matrix.build_name }}.zip
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
telegram-mcp-linux-x64/telegram-mcp-linux-x64.tar.gz
|
|
telegram-mcp-darwin-x64/telegram-mcp-darwin-x64.tar.gz
|
|
telegram-mcp-darwin-arm64/telegram-mcp-darwin-arm64.tar.gz
|
|
telegram-mcp-win-x64.exe/telegram-mcp-win-x64.exe.zip
|
|
draft: false
|
|
prerelease: false
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |