Skip to content

Release Build for Windows x64 #30

Release Build for Windows x64

Release Build for Windows x64 #30

name: Release Build for Windows x64
on:
workflow_dispatch:
inputs:
tagname:
description: "tagname"
type: string
required: true
build_type:
description: "Build type"
type: choice
required: true
default: "ci"
options:
- ci
- rel
jobs:
prepare-libraries:
name: Prepare Libraries
runs-on: windows-latest
env:
PREPARE_PATH: "Telegram/build/prepare/prepare.py"
defaults:
run:
shell: cmd
steps:
- name: Prepare directories
run: |
mkdir %userprofile%\TBuild\Libraries
mklink /d %GITHUB_WORKSPACE%\TBuild %userprofile%\TBuild
echo TBUILD=%GITHUB_WORKSPACE%\TBuild>>%GITHUB_ENV%
- name: Get repository name
shell: bash
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- uses: ilammy/msvc-dev-cmd@v1.13.0
name: Native Tools Command Prompt
with:
arch: x64
- name: Clone repository
uses: actions/checkout@v6
with:
submodules: recursive
path: ${{ env.TBUILD }}\${{ env.REPO_NAME }}
- name: Set up environment paths
shell: bash
run: |
echo "CACHE_KEY=$(sha256sum $TBUILD/$REPO_NAME/$PREPARE_PATH | awk '{ print $1 }')" >> $GITHUB_ENV
git config --global user.email "you@example.com"
git config --global user.name "Sample"
- name: NuGet sources
run: |
nuget sources Disable -Name "Microsoft Visual Studio Offline Packages"
nuget sources Add -Source https://api.nuget.org/v3/index.json & exit 0
- name: Prepare Libraries
env:
GYP_MSVS_OVERRIDE_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\'
GYP_MSVS_VERSION: 2022
run: |
cd %TBUILD%
%REPO_NAME%\Telegram\build\prepare\win.bat silent
- name: Clean up build intermediates
run: |
cd %TBUILD%
del /S /Q Libraries\*.pdb 2>nul
del /S /Q Libraries\*.pch 2>nul
del /S /Q Libraries\*.obj 2>nul
del /S /Q Libraries\*.ilk 2>nul
del /S /Q Libraries\*.exp 2>nul
del /S /Q Libraries\*.log 2>nul
del /S /Q Libraries\*.tlog 2>nul
for /d /r Libraries %%d in (.git) do @if exist "%%d" rd /s /q "%%d"
- name: Upload Libraries
uses: actions/upload-artifact@v6
with:
name: libraries-x64
path: ${{ env.TBUILD }}/Libraries
retention-days: 1
compression-level: 1
- name: Upload ThirdParty
uses: actions/upload-artifact@v6
with:
name: thirdparty-x64
path: ${{ env.TBUILD }}/ThirdParty
retention-days: 1
compression-level: 1
build-fagram:
name: Build FAgram Desktop
runs-on: windows-latest
needs: prepare-libraries
outputs:
app_version_str: ${{ steps.version.outputs.app_version_str }}
app_version_str_small: ${{ steps.version.outputs.app_version_str_small }}
app_version_str_full: ${{ steps.version.outputs.app_version_str_full }}
env:
UPLOAD_ARTIFACT: "true"
defaults:
run:
shell: cmd
steps:
- name: Prepare directories
run: |
mkdir %userprofile%\TBuild\Libraries
mkdir %userprofile%\TBuild\ThirdParty
mklink /d %GITHUB_WORKSPACE%\TBuild %userprofile%\TBuild
echo TBUILD=%GITHUB_WORKSPACE%\TBuild>>%GITHUB_ENV%
- name: Get repository name
shell: bash
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- uses: ilammy/msvc-dev-cmd@v1.13.0
name: Native Tools Command Prompt
with:
arch: x64
- name: Clone repository
uses: actions/checkout@v6
with:
submodules: recursive
path: ${{ env.TBUILD }}\${{ env.REPO_NAME }}
- name: Download Libraries
uses: actions/download-artifact@v7
with:
name: libraries-x64
path: ${{ env.TBUILD }}/Libraries
- name: Download ThirdParty
uses: actions/download-artifact@v7
with:
name: thirdparty-x64
path: ${{ env.TBUILD }}/ThirdParty
- name: Build Configuration
shell: bash
run: |
echo "TDESKTOP_BUILD_ARCH=x64" >> $GITHUB_ENV
echo "ARTIFACT_NAME=FAgram_Win-x64" >> $GITHUB_ENV
API="-D TDESKTOP_API_ID=${{ secrets.API_ID_CONFIG }} -D TDESKTOP_API_HASH=${{ secrets.API_HASH_CONFIG }}"
echo "TDESKTOP_BUILD_API=$API" >> $GITHUB_ENV
- name: Build FAgram Desktop
run: |
cd %TBUILD%\%REPO_NAME%\Telegram
call configure.bat ^
%TDESKTOP_BUILD_ARCH% ^
%TDESKTOP_BUILD_API% ^
-D CMAKE_C_FLAGS="/bigobj /WX-" ^
-D CMAKE_CXX_FLAGS="/bigobj /WX-" ^
-D DESKTOP_APP_DISABLE_AUTOUPDATE=NO ^
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF ^
-D DESKTOP_APP_NO_PDB=ON
cmake --build ..\out --config Release --parallel
- name: Get tag name
if: env.UPLOAD_ARTIFACT == 'true'
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.tagname }}" ]; then
echo "RELEASE_TAG=${{ github.event.inputs.tagname }}" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi
- name: Read version info
id: version
if: env.UPLOAD_ARTIFACT == 'true'
shell: bash
run: |
VERSION_FILE="$TBUILD/$REPO_NAME/Telegram/build/version"
APP_VERSION_STR=$(grep 'AppVersionStr ' "$VERSION_FILE" | awk '{print $2}')
APP_VERSION_STR_SMALL=$(grep 'AppVersionStrSmall' "$VERSION_FILE" | awk '{print $2}')
echo "APP_VERSION_STR=$APP_VERSION_STR" >> $GITHUB_ENV
echo "APP_VERSION_STR_SMALL=$APP_VERSION_STR_SMALL" >> $GITHUB_ENV
echo "APP_VERSION_STR_FULL=${APP_VERSION_STR}.0" >> $GITHUB_ENV
echo "app_version_str=$APP_VERSION_STR" >> $GITHUB_OUTPUT
echo "app_version_str_small=$APP_VERSION_STR_SMALL" >> $GITHUB_OUTPUT
echo "app_version_str_full=${APP_VERSION_STR}.0" >> $GITHUB_OUTPUT
- name: Prepare artifacts
if: env.UPLOAD_ARTIFACT == 'true'
run: |
cd %TBUILD%\%REPO_NAME%
set OUT=%TBUILD%\%REPO_NAME%\out\Release
if not exist artifact mkdir artifact
move %OUT%\*.exe artifact\
copy Telegram\Resources\art\icon.ico artifact\
cd artifact
7z a -tzip FAgram_Win-x64_%RELEASE_TAG%_portable.zip *.exe icon.ico
- uses: actions/upload-artifact@v6
name: Upload Release Artifacts
if: env.UPLOAD_ARTIFACT == 'true'
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.TBUILD }}/${{ env.REPO_NAME }}/artifact/
- name: Upload portable release
if: env.UPLOAD_ARTIFACT == 'true' && github.event.inputs.build_type == 'rel'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
name: FAgram ${{ env.RELEASE_TAG }}
draft: false
prerelease: false
files: |
${{ env.TBUILD }}/${{ env.REPO_NAME }}/artifact/FAgram_Win-x64_${{ env.RELEASE_TAG }}_portable.zip
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
build-installer:
name: Build Windows x64 Installer
needs: build-fagram
if: always() && needs.build-fagram.result == 'success'
uses: ./.github/workflows/win-installer-x64.yml
with:
artifact_name: FAgram_Win-x64
release_tag: ${{ github.event.inputs.tagname }}
build_type: ${{ github.event.inputs.build_type }}
run_id: ${{ github.run_id }}
secrets: inherit
update-scoop:
name: Update Scoop Manifest
needs: build-fagram
if: github.event.inputs.build_type == 'rel'
uses: ./.github/workflows/scoop-manifest.yml
with:
release_tag: ${{ github.event.inputs.tagname }}
secrets: inherit