[mod] releaes 2.3 for fix bug #261
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | |
on: | |
push: | |
branches: [ "main", "v*/**"] | |
pull_request: | |
branches: [ "main" , "v*/**"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Install python pip dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Prepare Env | |
id: Prepare | |
run: | | |
GIT_COMMIT=$(git rev-parse HEAD) | |
github_run_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | |
echo "GIT_COMMIT=$GIT_COMMIT$">> $GITHUB_ENV | |
echo "GITHUB_RUN_URL=$github_run_url">> $GITHUB_ENV | |
echo "GIT_BRANCH=`git branch --show-current`" >> $GITHUB_ENV | |
chmod +x robot.py | |
# debug | |
- name: Dump Env | |
run: env | sort | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: | | |
echo "$GITHUB_CONTEXT" | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# - name: Build with Gradle | |
# run: ./gradlew build | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: wrapper | |
arguments: build | |
- name: Prepare Artifact | |
if: success() | |
id: prepareArtifact | |
run: | | |
releaseArtifactName=`ls app/build/outputs/apk/release/*.apk | grep -Po "(?<=release/).*(?=\.apk)"` && echo "releaseArtifactName=$releaseArtifactName" >> $GITHUB_OUTPUT | |
debugArtifactName=`ls app/build/outputs/apk/debug/*.apk | grep -Po "(?<=debug/).*(?=\.apk)"` && echo "debugArtifactName=$debugArtifactName" >> $GITHUB_OUTPUT | |
- name: Upload Archive Release-Apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepareArtifact.outputs.releaseArtifactName }} | |
path: app/build/outputs/apk/release/*.apk | |
- name: Upload Archive Debug-Apk | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepareArtifact.outputs.debugArtifactName }} | |
path: ./app/build/outputs/apk/debug/*.apk | |
- name: Post Message | |
env: | |
CHAT_ID: ${{ secrets.TG_CI_CHAT_ID }} | |
BOT_TOKEN: ${{ secrets.TG_CI_BOT_TOKEN }} | |
run: | | |
echo "github_run_url=$GITHUB_RUN_URL" | |
echo '${{ toJson(github) }}'> github_context.txt | |
if [ -f "robot.py" ]; then | |
python robot.py -e ci | |
fi | |
# curl -X POST "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" -d "chat_id=$CHAT_ID&text=CI编译完成${github_run_url}" | |