tdlight-java-natives/.github/workflows/tdapi_file.yaml

155 lines
7.3 KiB
YAML
Raw Normal View History

name: Generate TdApi.java
2020-12-26 12:09:32 +01:00
on:
push:
2023-01-03 00:40:21 +01:00
branches:
- master
- develop
2020-12-26 12:09:32 +01:00
jobs:
build:
strategy:
matrix:
2020-12-26 12:20:40 +01:00
include:
2023-05-07 15:35:26 +02:00
- {os: ubuntu-22.04, arch: "linux/amd64", implementation: "tdlight"}
2020-12-26 12:16:14 +01:00
runs-on: ${{ matrix.os }}
2020-12-26 12:09:32 +01:00
steps:
2023-05-07 15:35:26 +02:00
- name: Install ubuntu 22.04 dependencies
if: matrix.os == 'ubuntu-22.04'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
2023-05-09 00:38:43 +02:00
packages: sudo make git zlib1g-dev libssl-dev gperf php-cli cmake openjdk-17-jdk clang-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev ccache maven
2023-05-07 15:35:26 +02:00
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 }}
2020-12-26 12:38:55 +01:00
- uses: actions/checkout@v2
with:
submodules: "recursive"
2020-12-28 00:16:13 +01:00
- name: Setup Java (Snapshot)
2023-01-03 00:40:21 +01:00
if: github.ref == 'refs/heads/develop'
2022-11-14 12:28:06 +01:00
uses: actions/setup-java@v3
2020-12-26 12:16:14 +01:00
with:
2021-10-22 11:16:57 +02:00
java-version: 17
2022-11-14 12:28:06 +01:00
distribution: temurin
server-id: mchv-snapshot-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
2023-05-09 10:45:22 +02:00
cache: 'maven'
2020-12-28 00:16:13 +01:00
- name: Setup Java (Release)
2023-01-03 00:40:21 +01:00
if: github.ref != 'refs/heads/develop'
2022-11-14 12:28:06 +01:00
uses: actions/setup-java@v3
2020-12-28 00:16:13 +01:00
with:
2021-10-22 11:16:57 +02:00
java-version: 17
2022-11-14 12:28:06 +01:00
distribution: temurin
2020-12-28 00:16:13 +01:00
server-id: mchv-release-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
2023-05-09 10:45:22 +02:00
cache: 'maven'
2020-12-26 12:09:32 +01:00
- name: Setup variables
2020-12-26 12:42:01 +01:00
shell: bash
2020-12-26 12:09:32 +01:00
run: |
2023-05-09 12:15:15 +02:00
set -xeo pipefail
2020-12-26 12:09:32 +01:00
# ====== Variables
2023-05-09 12:19:17 +02:00
export REVISION=4.0.${{ github.run_number }}
export GH_MATRIX_OS=${{ matrix.os }}
2020-12-26 12:45:53 +01:00
export GH_MATRIX_ARCH=${{ matrix.arch }}
2020-12-26 15:39:42 +01:00
export IMPLEMENTATION_NAME=${{ matrix.implementation }}
2020-12-26 12:36:31 +01:00
2020-12-26 12:09:32 +01:00
echo "REVISION=$REVISION" >> $GITHUB_ENV
2021-01-05 12:54:13 +01:00
echo "BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_ENV
2020-12-26 15:39:42 +01:00
echo "IMPLEMENTATION_NAME=$IMPLEMENTATION_NAME" >> $GITHUB_ENV
2021-09-14 15:03:15 +02:00
if [[ ! -z "$PATH" ]]; then
echo "PATH=$PATH" >> $GITHUB_ENV
fi
2020-12-26 12:09:32 +01:00
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "JAVA_INCLUDE_PATH=$JAVA_INCLUDE_PATH" >> $GITHUB_ENV
2020-12-26 15:06:44 +01:00
- name: Build
shell: bash
run: |
2023-05-09 12:15:15 +02:00
set -xeo pipefail
2020-12-26 15:06:44 +01:00
echo "REVISION: $REVISION"
2023-05-07 15:00:00 +02:00
./.github/workflows/scripts/build-api.sh
2023-05-09 10:43:04 +02:00
- uses: actions/upload-artifact@v3
with:
name: tdlight-api-${{env.REVISION}}.jar
path: api/target/tdlight-api-${{env.REVISION}}.jar
- uses: actions/upload-artifact@v3
with:
name: tdlight-api-${{env.REVISION}}-legacy.jar
2023-05-09 11:19:45 +02:00
path: api/target-legacy/tdlight-api-${{env.REVISION}}-legacy.jar
2020-12-28 00:16:13 +01:00
- name: Deploy to Maven (Snapshot)
2020-12-28 00:13:32 +01:00
if: github.ref != 'refs/heads/master'
shell: bash
run: |
2023-05-09 12:15:15 +02:00
set -xeo pipefail
echo "REVISION: $REVISION"
2023-05-07 15:00:00 +02:00
echo "Building standard package"
2023-05-09 12:15:15 +02:00
mvn -B -f api/pom.xml clean package deploy -Drevision="$REVISION"
2023-05-09 10:43:04 +02:00
echo "Deploying legacy package"
2023-05-09 12:15:15 +02:00
mvn -B -f api/pom.xml clean package -Dlegacy=true -Drevision="$REVISION"
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv-snapshot \
2023-05-09 10:43:04 +02:00
-DrepositoryId=mchv-snapshot-distribution \
2023-05-09 11:59:15 +02:00
-Dfile=api/target-legacy/tdlight-api-$REVISION-legacy.jar \
2023-05-09 12:15:15 +02:00
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-api \
-Dversion=$REVISION \
-Drevision=$REVISION \
2023-05-09 11:59:15 +02:00
-Dclassifier=legacy \
-Dlegacy=true
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
2020-12-28 00:16:13 +01:00
- name: Deploy to Maven (Release)
2020-12-27 21:08:01 +01:00
if: github.ref == 'refs/heads/master'
shell: bash
run: |
2023-05-09 12:15:15 +02:00
set -xeo pipefail
2020-12-27 21:08:01 +01:00
echo "REVISION: $REVISION"
2023-05-07 15:00:00 +02:00
echo "Deploying standard package"
2023-05-09 12:15:15 +02:00
mvn -B -f api/pom.xml clean package deploy -Drevision="$REVISION"
2023-05-09 10:43:04 +02:00
echo "Deploying legacy package"
2023-05-09 12:15:15 +02:00
mvn -B -f api/pom.xml clean package -Dlegacy=true -Drevision="$REVISION"
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv \
2023-05-09 10:43:04 +02:00
-DrepositoryId=mchv-release-distribution \
2023-05-09 11:19:45 +02:00
-Dfile=api/target-legacy/tdlight-api-$REVISION-legacy.jar \
2023-05-09 12:15:15 +02:00
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-api \
-Dversion=$REVISION \
-Drevision=$REVISION \
2023-05-09 11:59:15 +02:00
-Dclassifier=legacy \
-Dlegacy=true
2023-05-07 15:00:00 +02:00
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."
2020-12-27 21:08:01 +01:00
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
2023-04-26 16:49:16 +02:00
DOCS_DEPLOY_USERNAME: ${{ secrets.DOCS_DEPLOY_USERNAME }}
DOCS_DEPLOY_PASSWORD: ${{ secrets.DOCS_DEPLOY_PASSWORD }}
2020-12-26 12:09:32 +01:00