Deploy snapshot if no tag is found

This commit is contained in:
Andrea Cavalli 2021-10-22 20:15:39 +02:00
parent c0a275ae87
commit bc3246913a
4 changed files with 60 additions and 8 deletions

View File

@ -34,20 +34,32 @@ jobs:
echo "REVISION=$REVISION" >> $GITHUB_ENV
echo "IMPLEMENTATION_NAME=$IMPLEMENTATION_NAME" >> $GITHUB_ENV
- name: Set up JDK 17
- name: Set up JDK 17 (Snapshot)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/setup-java@v1
with:
java-version: 17
server-id: mchv-snapshot-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build (Snapshot)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: |
echo "IMPLEMENTATION_NAME: $IMPLEMENTATION_NAME"
source ./scripts/continuous-integration/github-workflows/deploy-snapshot.sh
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
- name: Set up JDK 17 (Release)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: actions/setup-java@v1
with:
java-version: 17
server-id: mchv-release-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: |
echo "IMPLEMENTATION_NAME: $IMPLEMENTATION_NAME"
source ./scripts/continuous-integration/github-workflows/only-compile-release.sh
- name: Deploy to Maven (Release)
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
shell: bash

View File

@ -0,0 +1,10 @@
#!/bin/bash -e
set -e
# OTHER REQUIRED ENVIRONMENT VARIABLES:
# IMPLEMENTATION_NAME = <tdlib | tdlight>
cd ./scripts/core/
./deploy_snapshot.sh
echo "Done."
exit 0

16
scripts/core/deploy_snapshot.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash -e
# OTHER REQUIRED ENVIRONMENT VARIABLES:
# IMPLEMENTATION_NAME = <tdlib | tdlight>
# Check variables correctness
if [ -z "${IMPLEMENTATION_NAME}" ]; then
echo "Missing parameter: IMPLEMENTATION_NAME"
exit 1
fi
cd ../../
mvn -B -P "${IMPLEMENTATION_NAME}" clean deploy
echo "Done."
exit 0

View File

@ -110,6 +110,8 @@ public final class ResponseReceiver extends Thread implements AutoCloseable {
}
cleanClientEventsArray(lastClientIdEventsCount);
assert areBoundsValid(clientEvents, 0, lastClientIdEventsCount);
eventsHandler.handleClientEvents(clientId,
lastClientClosed,
clientEventIds,
@ -198,6 +200,18 @@ public final class ResponseReceiver extends Thread implements AutoCloseable {
}
}
private boolean areBoundsValid(Object[] clientEvents, int start, int length) {
if (start > length) {
return false;
}
for (int i = start; i < length; i++) {
if (clientEvents[i] == null) {
return false;
}
}
return true;
}
private void cleanEventsArray(int eventsCount) {
if (eventsLastUsedLength > eventsCount) {
Arrays.fill(events, eventsCount, eventsLastUsedLength, null);