Skip to content

Commit

Permalink
update github action ci
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Nov 28, 2021
1 parent 10c10b4 commit 1a115b6
Showing 1 changed file with 62 additions and 1 deletion.
63 changes: 62 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
name: CI

on: [ push, pull_request ]
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '**/*.png'
- '**/*.jpg'

jobs:
publish:
Expand Down Expand Up @@ -34,3 +45,53 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle/wrapper/gradle-wrapper.properties', '**/buildSrc/src/main/kotlin/**.kt') }}
- name: Build
run: ./gradlew --parallel app:assembleRelease

apk:
name: Generate APK
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Build APK
run: ./gradlew --parallel app:assembleRelease
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: apk
path: app/build/outputs/apk/release/app-release.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@v2
with:
name: apk
- name: Display structure of downloaded files
run: ls -R

- name: Create Release
id: create_release
uses: actions/create-release@v1.1.4
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: ./app-release.apk
asset_name: app-release.apk
asset_content_type: application/zip

0 comments on commit 1a115b6

Please sign in to comment.