121 lines
4.6 KiB
YAML
121 lines
4.6 KiB
YAML
name: Generate TdApi.java
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- develop
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- {os: ubuntu-22.04, arch: "linux/amd64", implementation: "tdlight"}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Install ubuntu 22.04 dependencies
|
|
if: matrix.os == 'ubuntu-22.04'
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: sudo make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev ccache maven
|
|
version: 1.0
|
|
- name: Install SSH key
|
|
uses: shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ secrets.IG_SSH_KEY }}
|
|
name: id_rsa
|
|
known_hosts: ${{ secrets.IG_KNOWN_HOSTS }}
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: "recursive"
|
|
- name: Setup Java (Snapshot)
|
|
if: github.ref == 'refs/heads/develop'
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 17
|
|
distribution: temurin
|
|
server-id: mchv-snapshot-distribution
|
|
server-username: MAVEN_USERNAME
|
|
server-password: MAVEN_PASSWORD
|
|
- name: Setup Java (Release)
|
|
if: github.ref != 'refs/heads/develop'
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 17
|
|
distribution: temurin
|
|
server-id: mchv-release-distribution
|
|
server-username: MAVEN_USERNAME
|
|
server-password: MAVEN_PASSWORD
|
|
- name: Setup variables
|
|
shell: bash
|
|
run: |
|
|
# ====== Variables
|
|
export REVISION=${{ github.run_number }}
|
|
export GH_MATRIX_OS=${{ matrix.os }}
|
|
export GH_MATRIX_ARCH=${{ matrix.arch }}
|
|
export IMPLEMENTATION_NAME=${{ matrix.implementation }}
|
|
|
|
echo "REVISION=$REVISION" >> $GITHUB_ENV
|
|
echo "BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_ENV
|
|
echo "IMPLEMENTATION_NAME=$IMPLEMENTATION_NAME" >> $GITHUB_ENV
|
|
if [[ ! -z "$PATH" ]]; then
|
|
echo "PATH=$PATH" >> $GITHUB_ENV
|
|
fi
|
|
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
|
|
echo "JAVA_INCLUDE_PATH=$JAVA_INCLUDE_PATH" >> $GITHUB_ENV
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
echo "REVISION: $REVISION"
|
|
|
|
./.github/workflows/scripts/build-api.sh
|
|
- name: Deploy to Maven (Snapshot)
|
|
if: github.ref != 'refs/heads/master'
|
|
shell: bash
|
|
run: |
|
|
echo "REVISION: $REVISION"
|
|
|
|
echo "Deploying legacy package"
|
|
mvn -f api/pom.xml package deploy -Dlegacy=true -Drevision="-1.0.0.0-SNAPSHOT"
|
|
echo "Building standard package"
|
|
mvn -f api/pom.xml package deploy -Drevision="-1.0.0.0-SNAPSHOT"
|
|
env:
|
|
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
|
|
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
|
|
- name: Deploy to Maven (Release)
|
|
if: github.ref == 'refs/heads/master'
|
|
shell: bash
|
|
run: |
|
|
echo "REVISION: $REVISION"
|
|
|
|
echo "Deploying legacy package"
|
|
mvn -f api/pom.xml package deploy -Dlegacy=true -Drevision="$REVISION"
|
|
|
|
echo "Deploying standard package"
|
|
mvn -f api/pom.xml package deploy -Drevision="$REVISION"
|
|
|
|
|
|
echo "Deploying docs"
|
|
cd "./api/target/apidocs"
|
|
find . -name '*.html' -exec sed -i -r 's/<\/title>/<\/title>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><style>\n\t#memberSummary_tabpanel{overflow-x: auto;}\n\tli.blockList{overflow-x: auto;}\n\ttd.colLast div{max-width:30vw;}\n\t#search{width: 400px;max-width: 65vw;}\n\t.title,.subTitle,pre,.inheritance,h1,h2,h3,h4,h5,.memberSummary,.memberSignature,.typeSummary,.blockList,.contentContainer{white-space:normal;word-break:break-word;}\n\tul{padding-left:10px}\n<\/style>/' {} \;
|
|
git config --global init.defaultBranch master
|
|
git init
|
|
git checkout -b "tdlight"
|
|
git remote add origin "https://${DOCS_DEPLOY_USERNAME}:${DOCS_DEPLOY_PASSWORD}@git.ignuranza.net/tdlight-team/tdlight-docs"
|
|
git config user.email "andrea@warp.ovh"
|
|
git config user.name "Andrea Cavalli"
|
|
git fetch --all
|
|
git reset --soft "origin/tdlight" || true
|
|
git add -A
|
|
git commit -m "Update javadocs"
|
|
git push --set-upstream origin "tdlight"
|
|
|
|
echo "Done."
|
|
env:
|
|
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
|
|
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
|
|
DOCS_DEPLOY_USERNAME: ${{ secrets.DOCS_DEPLOY_USERNAME }}
|
|
DOCS_DEPLOY_PASSWORD: ${{ secrets.DOCS_DEPLOY_PASSWORD }}
|
|
|