diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..263b202 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,62 @@ +name: Android CI + +on: + push: + branches: + - master + tags: + - 'v*' + +jobs: + apk: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + env: + USERNAME: ${{ github.actor }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload APK + uses: actions/upload-artifact@v1 + with: + name: apk + path: app/build/intermediates/apk/debug/app-debug.apk + release: + name: Release APK + needs: apk + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Download APK from build + uses: actions/download-artifact@v1 + with: + name: apk + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + - name: Upload Release APK + id: upload_release_asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: apk/app-debug.apk + asset_name: EasyToken.apk + asset_content_type: application/zip