diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1307c79 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build + +on: + workflow_dispatch: + push: + branches: [ master ] + tags: [ v* ] + pull_request: + merge_group: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: "recursive" + fetch-depth: 0 + + - name: Write key + if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }} + run: | + if [ ! -z "${{ secrets.KEY_STORE }}" ]; then + echo storePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> keystore.properties + echo keyAlias='${{ secrets.ALIAS }}' >> keystore.properties + echo keyPassword='${{ secrets.KEY_PASSWORD }}' >> keystore.properties + echo storeFile=$PWD/'key.jks' >> keystore.properties + echo '${{ secrets.KEY_STORE }}' | base64 --decode > key.jks + fi + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-home-cache-cleanup: true + + - name: Build with Gradle + run: | + chmod +x ./gradlew + ./gradlew assemble + + - name: Upload release + uses: actions/upload-artifact@v4 + with: + name: "KsuWebUI-release" + path: "./app/build/outputs/apk/release/*.apk" + + - name: Upload release mapping + uses: actions/upload-artifact@v4 + with: + name: "KsuWebUI-release-mappings" + path: "./app/build/outputs/mapping/release" + + - name: Upload debug + uses: actions/upload-artifact@v4 + with: + name: "KsuWebUI-debug" + path: "./app/build/outputs/apk/debug/*.apk"