diff --git a/.github/workflows/build-noti.yml b/.github/workflows/build-noti.yml new file mode 100644 index 0000000..2ec2b58 --- /dev/null +++ b/.github/workflows/build-noti.yml @@ -0,0 +1,75 @@ +name: APK Builder + +on: + workflow_dispatch: + +jobs: + apk: + name: Generate APK + runs-on: ubuntu-latest + steps: + - name: Checkout REPO + uses: actions/checkout@v4 + with: + repository: Burhanverse/Noti + + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup Keystore + env: + KEYSTORE: ${{ secrets.KEYSTORE }} + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + run: | + echo "storePassword=$KEYSTORE_PASSWORD" >> keystore.properties + echo "keyAlias=$KEY_ALIAS" >> keystore.properties + echo "keyPassword=$KEY_PASSWORD" >> keystore.properties + echo "storeFile=${{ github.workspace }}/key.jks" >> keystore.properties + echo "$KEYSTORE" | base64 --decode > "${{ github.workspace }}/key.jks" + + - name: Extract repository name + id: extract_repo_name + run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Build Release APK + run: | + ./gradlew assembleRelease \ + -PKEYSTORE_FILE=${{ github.workspace }}/key.jks \ + -PKEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} \ + -PKEY_ALIAS=${{ secrets.KEY_ALIAS }} \ + -PKEY_PASSWORD=${{ secrets.KEY_PASSWORD }} --stacktrace + mv ./app/build/outputs/apk/release/app-release.apk "./${{ env.REPO_NAME }}.apk" + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.REPO_NAME }}.apk + path: ./${{ env.REPO_NAME }}.apk + + - name: Create Release + id: create_release + uses: actions/create-release@v1.14.0 + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} + with: + tag_name: ${{ github.run_number }} + release_name: Release ${{ github.run_number }} + + - name: Upload Release APK + id: upload_release_asset + uses: actions/upload-release-asset@v1.1.3 + env: + GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.REPO_NAME }}.apk + asset_name: ${{ env.REPO_NAME }}.apk + asset_content_type: application/vnd.android.package-archive