Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release Telegram Bot API | |
on: | |
push: | |
tags: | |
- "v*" | |
env: | |
BIN_PATH: /tmp/bin | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, ubuntu-22.04, macos-latest, windows-latest] | |
arch: [amd64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up dependencies | |
run: sudo apt-get update;sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake clang-14 libc++-14-dev libc++abi-14-dev | |
- name: Remove old telegram-bot-api | |
run: rm -rf telegram-bot-api | |
- name: Clone telegram-bot-api repository | |
run: git clone --recursive https://github.com/tdlib/telegram-bot-api.git | |
- name: Build telegram-bot-api binary | |
env: | |
GOARCH: ${{ matrix.arch }} | |
GOOS: ${{ env.GOOS }} | |
EXT: ${{ env.EXT }} | |
run: | | |
cd telegram-bot-api | |
rm -rf build | |
mkdir -p build | |
cd build | |
CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. | |
cmake --build . --target install | |
cd ../.. | |
# tar -czvf telegram-bot-api.tar.gz telegram-bot-api/bin/telegram-bot-api | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: telegram-bot-api-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | |
path: telegram-bot-api-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | |
release: | |
name: Create GitHub Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create bin directory | |
run: | | |
mkdir -p ${{ env.BIN_PATH }} | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ env.BIN_PATH }} | |
pattern: telegram-bot-api-* | |
merge-multiple: true | |
- name: Display structure of downloaded files | |
run: ls -R ${{ env.BIN_PATH }} | |
- name: Release with assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ env.BIN_PATH }}/* | |
# - name: Create Release | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ github.event.release.tag_name }} | |
# release_name: Release ${{ github.event.release.tag_name }} | |
# draft: false | |
# prerelease: false | |
# - name: Upload Release Asset | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: ./telegram-bot-api.tar.gz | |
# asset_name: telegram-bot-api.tar.gz | |
# asset_content_type: application/gzip |