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

86 lines
2.7 KiB
YAML
Raw Normal View History

2020-09-12 17:47:09 +02:00
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
2020-09-12 17:47:09 +02:00
jobs:
build-app:
runs-on: ubuntu-latest
steps:
- name: Clone Repository (Latest)
uses: actions/checkout@v2
with:
2020-12-27 20:58:07 +01:00
repository: 'tachiyomiorg/tachiyomi'
2020-09-12 17:47:09 +02:00
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:
2020-12-27 20:58:07 +01:00
repository: 'tachiyomiorg/tachiyomi'
2020-09-12 17:47:09 +02:00
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
2020-09-12 17:47:09 +02:00
- 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 }}
2020-12-27 20:58:07 +01:00
Latest commit: https://github.com/tachiyomiorg/tachiyomi/commit/${{ env.CURRENT_SHA }}
draft: ${{ github.event.inputs.dry-run != '' }}
2020-09-12 17:47:09 +02:00
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
2020-12-12 22:26:46 +01:00
2020-12-14 03:06:00 +01:00
- name: Prune old releases
uses: dev-drprasad/delete-older-releases@v0.2.0
2020-12-12 22:26:46 +01:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
keep_latest: 10
delete_tags: true