mihon-preview/.github/workflows/build_app.yml

78 lines
2.5 KiB
YAML

name: Build job
on:
# Every Saturday at 16:00 UTC-5
schedule:
- cron: '0 21 * * 6'
# Manual triggers
workflow_dispatch:
inputs:
git-ref:
description: Git Ref (Optional)
required: false
dry-run:
description: Creates a draft release
required: false
jobs:
build-app:
runs-on: ubuntu-latest
steps:
- name: Clone Repository (Latest)
uses: actions/checkout@v2
with:
repository: 'inorichi/tachiyomi'
fetch-depth: 0
if: github.event.inputs.git-ref == ''
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v2
if: github.event.inputs.git-ref != ''
with:
repository: 'inorichi/tachiyomi'
fetch-depth: 0
ref: ${{ github.event.inputs.git-ref }}
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up keystore
run: mkdir -p ~/.android/ && echo "${{ secrets.DEBUG_KEYSTORE }}" | base64 --decode > ~/.android/debug.keystore
- name: Build APK
uses: eskatos/gradle-command-action@v1
with:
arguments: assembleStandardDebug
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
- name: Set env variables
run: |
set -x
echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
echo "CURRENT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: r${{ env.COMMIT_COUNT }}
release_name: Tachiyomi Preview r${{ env.COMMIT_COUNT }}
body: >
r${{ env.COMMIT_COUNT }}
Latest commit: https://github.com/inorichi/tachiyomi/commit/${{ env.CURRENT_SHA }}
draft: ${{ github.event.inputs.dry-run != '' }}
prerelease: false
- name: Upload APK to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/standard/debug/app-standard-debug.apk
asset_name: tachiyomi-r${{ env.COMMIT_COUNT }}.apk
asset_content_type: application/vnd.android.package-archive