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

131 lines
4.8 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:
- {os: ubuntu-20.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:
2020-12-26 12:38:55 +01:00
- name: Install sudo package
2020-12-26 12:42:01 +01:00
if: runner.os == 'Linux'
2020-12-26 12:38:55 +01:00
run: |
(apt-get update || true) 2>/dev/null
(apt-get install -y sudo || true) 2>/dev/null
sudo apt update
- 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
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
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: |
# ====== Variables
2020-12-26 12:45:53 +01:00
export REVISION=${{ 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: |
echo "REVISION: $REVISION"
2023-05-07 15:00:00 +02:00
./.github/workflows/scripts/build-api.sh
- id: getfilename
2020-12-27 19:04:46 +01:00
shell: bash
2023-05-07 15:00:00 +02:00
run: echo "::set-output name=file::$(cd api/target; ls tdli*-api-*-SNAPSHOT.jar)"
2020-12-27 19:04:46 +01:00
- id: getfilepath
shell: bash
2023-05-07 15:00:00 +02:00
run: echo "::set-output name=file::$(ls api/target/tdli*-api-*-SNAPSHOT.jar)"
2020-12-26 12:09:32 +01:00
- uses: actions/upload-artifact@v2
with:
2020-12-27 19:04:46 +01:00
name: ${{ steps.getfilename.outputs.file }}
path: ${{ steps.getfilepath.outputs.file }}
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: |
echo "REVISION: $REVISION"
2023-05-07 15:00:00 +02:00
echo "Deploying legacy package"
mvn -f api/pom.xml deploy -Dlegacy=true
echo "Building standard package"
mvn -f api/pom.xml deploy
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: |
echo "REVISION: $REVISION"
2023-05-07 15:00:00 +02:00
echo "Deploying legacy package"
mvn -f api/pom.xml deploy -Dlegacy=true -Drevision="$REVISION"
echo "Deploying standard package"
mvn -f api/pom.xml 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."
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