diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f52db363..4e2f2969 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,34 +1,56 @@ -name: CI +name: Build on: push: - branches: "*" + paths-ignore: + - "CONTRIB" + - "LICENSE" + - "PRIVACY" + - "README.md" pull_request: branches: [ "master" ] + workflow_dispatch: jobs: build: - + name: Build runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' - - name: Install Bazel - run: | - sudo apt install apt-transport-https curl gnupg -y - curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg - sudo mv bazel-archive-keyring.gpg /usr/share/keyrings - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list - sudo apt update - sudo apt install bazel -y + + - name: Setup Bazel + uses: bazel-contrib/setup-bazel@0.8.4 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + - name: Build run: | - chmod +X build.sh + chmod +x build.sh ./build.sh + - name: Test - run: bazel test :all \ No newline at end of file + run: bazel test :all + + - name: Set environments + run: | + { + echo "commit=$(echo ${{ github.sha }} | cut -c-7)" + echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})" + echo "version=v$(grep -o 'android:versionName="[^"]*"' src/main/AndroidManifest.xml | awk -F'"' '{print $2}')" + } >> $GITHUB_ENV + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: ${{ env.repo }}-${{ env.version }}@${{ env.commit }} + path: bazel-bin/*.apk