Build TDWeb #56
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
# This is a basic workflow to help you get started with Actions | |
name: Build TDWeb | |
# Controls when the workflow will run | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
version: | |
required: true | |
ref: | |
default: master | |
description: TDLib repo ref (commit/tag/branch) | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: repo | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 15 | |
- name: Install webpack | |
run: npm install -g webpack | |
- name: Checkout EMSDK | |
uses: actions/checkout@v2 | |
with: | |
repository: emscripten-core/emsdk | |
path: emsdk | |
- name: Set-up EMSDK | |
run: | | |
cd emsdk | |
./emsdk install 2.0.6 | |
./emsdk activate 2.0.6 | |
cd .. | |
shell: bash | |
- name: Install TDLib dependencies | |
run: sudo apt install cmake make clang openssl zlib1g gperf php | |
shell: bash | |
- name: Checkout TDLib | |
uses: actions/checkout@v2 | |
with: | |
repository: tdlib/td | |
ref: ${{ github.event.inputs.ref }} | |
path: td | |
- name: Patch build script | |
run: | | |
sed -i -- 's/set(TD_LINKER_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL")/# set(TD_LINKER_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL")/g' "${GITHUB_WORKSPACE}/td/CMake/TdSetUpCompiler.cmake" | |
shell: bash | |
- name: Build OpenSSL | |
run: | | |
cd emsdk | |
source ./emsdk_env.sh | |
cd ../td/example/web | |
./build-openssl.sh | |
shell: bash | |
- name: Build TDLib | |
run: | | |
cd emsdk | |
source ./emsdk_env.sh | |
cd ../td/example/web | |
./build-tdlib.sh | |
shell: bash | |
- name: Copy TDLib | |
run: | | |
cd emsdk | |
source ./emsdk_env.sh | |
cd ../td/example/web | |
./copy-tdlib.sh | |
shell: bash | |
- name: Build TDWeb | |
run: | | |
cd emsdk | |
source ./emsdk_env.sh | |
cd ../td/example/web | |
./build-tdweb.sh | |
- name: Install tdweb dependencies | |
run: | | |
cd repo | |
npm ci | |
- name: Replace src and dist folders | |
run: | | |
rm -rf ./repo/src | |
cp -r ./td/example/web/tdweb/src ./repo | |
rm -rf ./repo/dist | |
cp -r ./td/example/web/tdweb/dist ./repo | |
- name: Commit changes | |
uses: zwaldowski/git-commit-action@v1 | |
with: | |
# Directory to create commit in | |
working_directory: ./repo | |
# Commit message | |
commit_message: Update to ${{ github.event.inputs.version }} | |
- name: Update npm version | |
run: | | |
cd repo | |
npm version ${{ github.event.inputs.version }} | |
git tag -d v${{ github.event.inputs.version }} | |
git reset --soft HEAD~2 | |
- name: Commit changes again | |
uses: zwaldowski/git-commit-action@v1 | |
with: | |
# Directory to create commit in | |
working_directory: ./repo | |
# Commit message | |
commit_message: Update to ${{ github.event.inputs.version }} | |
- name: Tag & push | |
run: | | |
cd repo | |
git tag v${{ github.event.inputs.version }} | |
git push | |
- name: Publish to NPM | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
package: ./repo/package.json |