-
Notifications
You must be signed in to change notification settings - Fork 10
159 lines (149 loc) · 7.43 KB
/
tdapi_file.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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 openjdk-17-jdk clang-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev 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@v3
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
cache: 'maven'
- 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
cache: 'maven'
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.2
- name: Setup variables
shell: bash
run: |
set -xeo pipefail
# ====== Variables
export REVISION=4.0.${{ 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
cat $GITHUB_ENV > github.env
- name: Build
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
./.github/workflows/scripts/build_api.sh
- 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
path: api/target-legacy/tdlight-api-${{env.REVISION}}-legacy.jar
- name: Deploy to Maven (Snapshot)
if: github.ref != 'refs/heads/master'
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
echo "Building standard package"
mvn -B -f api/pom.xml clean package deploy -Drevision="$REVISION"
echo "Deploying legacy package"
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 \
-DrepositoryId=mchv-snapshot-distribution \
-Dfile=api/target-legacy/tdlight-api-$REVISION-legacy.jar \
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-api \
-Dversion=$REVISION \
-Drevision=$REVISION \
-Dclassifier=legacy \
-Dlegacy=true
echo "Done."
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: |
set -xeo pipefail
echo "REVISION: $REVISION"
echo "Deploying standard package"
mvn -B -f api/pom.xml clean package deploy -Drevision="$REVISION"
echo "Deploying legacy package"
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 \
-DrepositoryId=mchv-release-distribution \
-Dfile=api/target-legacy/tdlight-api-$REVISION-legacy.jar \
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-api \
-Dversion=$REVISION \
-Drevision=$REVISION \
-Dclassifier=legacy \
-Dlegacy=true
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 "[email protected]"
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 }}