From 93d8ebbb6ad040818b9c46462077a40f90bc3174 Mon Sep 17 00:00:00 2001 From: kairusds <32636532+kairusds@users.noreply.github.com> Date: Sat, 12 Oct 2024 03:44:58 +0800 Subject: [PATCH] Add build workflow --- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9e72ba7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,72 @@ +name: Build Library + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[ci skip]')" + steps: + - uses: actions/checkout@v4 + - uses: gradle/actions/wrapper-validation@v4 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: 8 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup Android ndk r15c + run: | + sudo apt install libncurses5 + wget https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip + unzip android-ndk-r15c-linux-x86_64.zip + echo "ndk.dir=$(realpath android-ndk-r15c)" > local.properties + + - name: Setup gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build library + run: ./gradlew assembleRelease + + - name: Set release environment variables + run: | + echo "AAR_SHA256=$(sha256sum imagefilters/build/outputs/aar/imagefilters-release.aar | awk '{ print $1 }')" >> $GITHUB_ENV + + - name: Set lib version env variables + run: | + VERSION_NAME=$(grep -oP 'versionName\s*"\K[^"]+' imagefilters/build.gradle) + VERSION_CODE=$(grep -oP 'versionCode\s*\K\d+' imagefilters/build.gradle) + echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV + echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV + + - name: Upload binaries to a release + id: release + uses: softprops/action-gh-release@v2 + with: + files: | + imagefilters/build/outputs/aar/imagefilters-release.aar + tag_name: "v${{ env.VERSION_NAME }}-${{ env.VERSION_CODE }}" + + - name: Edit release body + run: | + BODY=$(cat <